You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by mx...@apache.org on 2017/11/07 13:50:57 UTC

[1/3] incubator-ariatosca git commit: ARIA-393 Enable configuration of extension loading mechanism strictness [Forced Update!]

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-392-Failing-to-load-ruamel.yaml 720fa23b8 -> f32c752f1 (forced update)


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/19e95f77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/19e95f77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/19e95f77

Branch: refs/heads/ARIA-392-Failing-to-load-ruamel.yaml
Commit: 19e95f77b9ac4e964da08a7c09de59aa68237b7e
Parents: b1f03ef
Author: max-orlov <ma...@gigaspaces.com>
Authored: Mon Oct 23 15:55:46 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Tue Nov 7 10:57:08 2017 +0200

----------------------------------------------------------------------
 aria/__init__.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/19e95f77/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index 9fe8b3d..a059877 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -46,18 +46,29 @@ __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.
 
     It then invokes all registered extension functions.
+
+    :param strict: if set to ``True``, Tries to load extensions with
+     dependency versions under consideration. Otherwise tries to load the
+     required package without version consideration. Defaults to True.
+    :type strict: bool
     """
     for loader, module_name, _ in iter_modules():
         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()
 
 


[3/3] incubator-ariatosca git commit: review 1 fix

Posted by mx...@apache.org.
review 1 fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/f32c752f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f32c752f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f32c752f

Branch: refs/heads/ARIA-392-Failing-to-load-ruamel.yaml
Commit: f32c752f1bf8546beeeb361f3e41164fa915e50c
Parents: 0c4b2aa
Author: max-orlov <ma...@gigaspaces.com>
Authored: Sun Nov 5 12:09:54 2017 +0200
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Tue Nov 7 15:50:45 2017 +0200

----------------------------------------------------------------------
 aria/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f32c752f/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index f04b549..5c102de 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -30,7 +30,7 @@ __version__ = pkg_resources.get_distribution(aria_package_name).version
 
 
 try:
-    import ruamel                                           # noqa: F401
+    import ruamel
 except ImportError:
     if sys.version_info[0] > 2:
         raise


[2/3] incubator-ariatosca git commit: ARIA-392 Failing to load ruamel.yaml

Posted by mx...@apache.org.
ARIA-392 Failing to load ruamel.yaml


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/0c4b2aa2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c4b2aa2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c4b2aa2

Branch: refs/heads/ARIA-392-Failing-to-load-ruamel.yaml
Commit: 0c4b2aa2aff17c211fcc1f7d91d162eef125bb14
Parents: 19e95f7
Author: max-orlov <ma...@gigaspaces.com>
Authored: Mon Oct 23 15:58:14 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Tue Nov 7 15:50:45 2017 +0200

----------------------------------------------------------------------
 aria/__init__.py | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c4b2aa2/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index a059877..f04b549 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -17,14 +17,45 @@
 The ARIA root package provides entry points for extension and storage initialization.
 """
 
+import os
 import sys
+import types
 
 from pkgutil import iter_modules
 import pkg_resources
-
 aria_package_name = 'apache-ariatosca'
 __version__ = pkg_resources.get_distribution(aria_package_name).version
 
+
+
+
+try:
+    import ruamel                                           # noqa: F401
+except ImportError:
+    if sys.version_info[0] > 2:
+        raise
+
+    # Traverse all of the site-packages and try to load ruamel.
+    for packages_dir in sys.path:
+        ruamel_path = os.path.join(packages_dir, 'ruamel')
+        if not os.path.exists(ruamel_path):
+            continue
+
+        # If the top dir has an __init__.py file, the loading should have
+        # succeeded automatically
+        if os.path.exists(os.path.join(ruamel_path, '__init__.py')):
+            raise
+
+        # Dynamically create mapping to the ruamel package
+        ruamel_module = sys.modules.setdefault(
+            'ruamel',
+            types.ModuleType('ruamel')
+        )
+        # add path to the mapped package
+        ruamel_module.__dict__.setdefault('__path__', []).append(ruamel_path)
+
+
+
 from .orchestrator.decorators import workflow, operation  # pylint: disable=wrong-import-position
 from . import (  # pylint: disable=wrong-import-position
     extension,