API Reference¶
manifestoo_core.addon¶
- class manifestoo_core.addon.Addon¶
Represent a concrete addon manifest.
- __init__(manifest, manifest_path, name=None)¶
Do not use this constructor, use the from_addon_dir classmethod instead.
- Parameters:
manifest (Manifest)
manifest_path (Path)
name (str | None)
- Return type:
None
- manifest_path: Path¶
The path to the addon’s manifest file.
- name: str¶
The addon’s name.
- classmethod from_addon_dir(addon_dir, allow_not_installable=False)¶
Obtain an Addon object from an addon directory path.
Raises an
AddonNotFoundexception if the directory is not a valid addon directory, or ifallow_not_installableis False and the addon is not installable.- Parameters:
addon_dir (Path)
allow_not_installable (bool)
- Return type:
- manifestoo_core.addon.is_addon_dir(addon_dir, allow_not_installable=False)¶
Detect if a directory contains an Odoo addon.
- Parameters:
addon_dir (Path) – The directory to check.
allow_not_installable (bool) – Whether to allow the addon to be have installable=False in its manifest.
- Return type:
bool
manifestoo_core.manifest¶
- exception manifestoo_core.manifest.InvalidManifest¶
- class manifestoo_core.manifest.Manifest¶
Represent an Odoo manifest file.
- __init__(manifest_dict)¶
Do not use this contructor, use the from_* classmethods instead.
- Parameters:
manifest_dict (Dict[str, Any])
- Return type:
None
- property name: str | None¶
The name field.
- property summary: str | None¶
The value of the summary field.
- property description: str | None¶
The value of the description field.
- property version: str | None¶
The value of the version field.
- property installable: bool¶
The value of the installable field if set, else True.
- property depends: List[str]¶
The value of the depends field if set, else [].
- property external_dependencies: Dict[str, Any]¶
The value of the external_dependencies field if set, else {}.
- property license: str | None¶
The value of the license field.
- property author: str | None¶
The value of the author field.
- property authors: Tuple[str, ...] | None¶
The value of the author field as a list of authors.
The author field is split by commas and empty values are removed. Leading and trailing spaces are stripped from each author.
- property category: str | None¶
The value of the category field.
- property website: str | None¶
The value of the website field.
- property development_status: str | None¶
The value of the development_status field.
- classmethod from_dict(manifest_dict, source='<manifest>')¶
Parse a manifest dictionary into a
Manifestobject.Raises
InvalidManifestif the manifest is invalid.- Parameters:
manifest_dict (Dict[Any, Any])
source (str)
- Return type:
- classmethod from_str(manifest_str, source='<manifest>')¶
Parse a manifest string into a
Manifestobject.Raises
InvalidManifestif the manifest is invalid.- Parameters:
manifest_str (str)
source (str)
- Return type:
- classmethod from_file(manifest_path)¶
Parse a manifest file into a
Manifestobject.Raises
InvalidManifestif the manifest is invalid.- Parameters:
manifest_path (Path)
- Return type:
- manifestoo_core.manifest.get_manifest_path(addon_dir)¶
Get the path to the manifest file for an addon directory.
Returns None if no manifest file is found.
- Parameters:
addon_dir (Path)
- Return type:
Path | None
manifestoo_core.core_addons¶
Information about core Odoo addons.
- manifestoo_core.core_addons.get_core_addon_license(addon_name, odoo_series)¶
Get the license of a core Odoo addon.
This function overrides any license set in the upstream addon manifest, as Odoo has a uniform license for each version and edition, and the manifests have been known to be unreliable in that respect.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
str
- manifestoo_core.core_addons.get_core_addons(odoo_series)¶
Return the set of core Odoo addons for a given Odoo series.
- Parameters:
odoo_series (OdooSeries)
- Return type:
Set[str]
- manifestoo_core.core_addons.is_core_addon(addon_name, odoo_series)¶
Test wether an addon is part of a given Odoo series.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
bool
- manifestoo_core.core_addons.is_core_ce_addon(addon_name, odoo_series)¶
Test wether an addon is part of the Community Edition of a given Odoo series.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
bool
- manifestoo_core.core_addons.is_core_ee_addon(addon_name, odoo_series)¶
Test wether an addon is part of the Enterprise Edition of a given Odoo series.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
bool
manifestoo_core.exceptions¶
- exception manifestoo_core.exceptions.ManifestooException¶
Base class of all manifestoo_core exceptions.
- exception manifestoo_core.exceptions.UnsupportedOdooSeries¶
- manifestoo_core.exceptions.UnsupportedOdooVersion¶
alias of
UnsupportedOdooSeries
- exception manifestoo_core.exceptions.UnsupportedManifestVersion¶
- exception manifestoo_core.exceptions.InvalidManifest¶
- exception manifestoo_core.exceptions.AddonNotFound¶
- exception manifestoo_core.exceptions.AddonNotFoundNotInstallable¶
- exception manifestoo_core.exceptions.AddonNotFoundNoInit¶
- exception manifestoo_core.exceptions.AddonNotFoundNoManifest¶
- exception manifestoo_core.exceptions.AddonNotFoundNotADirectory¶
- exception manifestoo_core.exceptions.AddonNotFoundInvalidManifest¶
- exception manifestoo_core.exceptions.InvalidDistributionName¶
- exception manifestoo_core.exceptions.UnknownPostVersionStrategy¶
manifestoo_core.metadata¶
- manifestoo_core.metadata.addon_name_to_distribution_name(addon_name, odoo_series)¶
Convert an Odoo addon name to the corresponding packaging distribution name.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
str
- manifestoo_core.metadata.addon_name_to_requirement(addon_name, odoo_series)¶
Convert an Odoo addon name to a requirement specifier.
- Parameters:
addon_name (str)
odoo_series (OdooSeries)
- Return type:
str
- manifestoo_core.metadata.distribution_name_to_addon_name(metadata_name)¶
Convert a packaging distribution name to the corresponding Odoo addon name.
- Parameters:
metadata_name (str)
- Return type:
str
- manifestoo_core.metadata.metadata_from_addon_dir(addon_dir, options=None, precomputed_metadata_file=None)¶
Return Python Package Metadata 2.1 for an Odoo addon directory as an
email.message.Message.The Description field is absent and is stored in the message payload. All values are guaranteed to not contain newline characters, except for the payload.
precomputed_metadata_pathmay point to a file containing pre-computed metadata that will be used to obtain the Name and Version, instead of looking at the addon directory name or manifest version + VCS, respectively. This is useful to process a manifest from a sdist tarball with PKG-INFO, for example, when the original directory name or VCS is not available to compute the package name and version.This function may raise
manifestoo_core.exceptions.ManifestooExceptionifaddon_dirdoes not contain a valid installable Odoo addon for a supported Odoo version.- Parameters:
addon_dir (Path)
options (MetadataOptions | None)
precomputed_metadata_file (Path | None)
- Return type:
Message
manifestoo_core.odoo_series¶
Odoo Series and Editions.
- class manifestoo_core.odoo_series.OdooSeries¶
Enum representing an Odoo Series (also known as Version).
- v8_0 = '8.0'¶
- v9_0 = '9.0'¶
- v10_0 = '10.0'¶
- v11_0 = '11.0'¶
- v12_0 = '12.0'¶
- v13_0 = '13.0'¶
- v14_0 = '14.0'¶
- v15_0 = '15.0'¶
- v16_0 = '16.0'¶
- v17_0 = '17.0'¶
- v18_0 = '18.0'¶
- v19_0 = '19.0'¶
- classmethod from_str(value, context=None)¶
Get the OdooSeries from a string.
Raise UnsupportedOdooSeries if the string is not recognized.
- Parameters:
value (str)
context (str | None)
- Return type:
- __new__(value)¶
- class manifestoo_core.odoo_series.OdooEdition¶
Enum representing an Odoo Edition.
- CE = 'c'¶
- EE = 'e'¶
- __new__(value)¶
- manifestoo_core.odoo_series.detect_from_addon_version(version)¶
Detect the Odoo Series from an addon version.
Returns
Noneif the version is not recognized.- Parameters:
version (str)
- Return type:
OdooSeries | None