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/f62e397e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f62e397e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f62e397e Branch: refs/heads/ARIA-393-Enable-configuration-of-extension-loading-mechanism-strictness Commit: f62e397edfb5dff836e71bfa5376b5a8f9b58705 Parents: b1f03ef Author: max-orlov <ma...@gigaspaces.com> Authored: Mon Oct 23 15:55:46 2017 +0300 Committer: max-orlov <ma...@gigaspaces.com> Committed: Thu Nov 2 17:13:31 2017 +0200 ---------------------------------------------------------------------- aria/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f62e397e/aria/__init__.py ---------------------------------------------------------------------- diff --git a/aria/__init__.py b/aria/__init__.py index 9fe8b3d..754c86c 100644 --- a/aria/__init__.py +++ b/aria/__init__.py @@ -46,7 +46,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. @@ -57,7 +57,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()