Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-393-Enable-configuration-of-extension-loading-mechanism-strictness [created] 8a90e1fe5
ARIA-393 Enable configuration of extension loading mechanism strictness Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8a90e1fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8a90e1fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8a90e1fe Branch: refs/heads/ARIA-393-Enable-configuration-of-extension-loading-mechanism-strictness Commit: 8a90e1fe5591ac9664f84f1bdd461d8d5642bdcb Parents: 737fff5 Author: max-orlov <[email protected]> Authored: Mon Oct 23 15:55:46 2017 +0300 Committer: max-orlov <[email protected]> Committed: Mon Oct 23 15:55:46 2017 +0300 ---------------------------------------------------------------------- aria/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a90e1fe/aria/__init__.py ---------------------------------------------------------------------- diff --git a/aria/__init__.py b/aria/__init__.py index 76a62ce..f5e08f3 100644 --- a/aria/__init__.py +++ b/aria/__init__.py @@ -51,7 +51,7 @@ __all__ = ( ) -def install_aria_extensions(): +def install_aria_extensions(strict=True): """ Iterates all Python packages with names beginning with ``aria_extension_`` and all ``aria_extension`` entry points and loads them. @@ -62,7 +62,13 @@ def install_aria_extensions(): if module_name.startswith('aria_extension_'): loader.find_module(module_name).load_module(module_name) for entry_point in pkg_resources.iter_entry_points(group='aria_extension'): - entry_point.load() + # It should be possible to enable non strict loading - use the package + # that is already installed inside the environment, and forgo the + # version demand + if strict: + entry_point.load() + else: + entry_point.resolve() extension.init()
