libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [2/2] libcloud git commit: update feature provider table to not require pysphere and also work on python3
Date Mon, 17 Jul 2017 20:29:38 GMT
update feature provider table to not require pysphere and also work on python3


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/830fbd87
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/830fbd87
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/830fbd87

Branch: refs/heads/trunk
Commit: 830fbd870942d50f1599a64fb2f93a5313d34694
Parents: 0a455a9
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Mon Jul 17 21:29:20 2017 +0100
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Mon Jul 17 21:29:20 2017 +0100

----------------------------------------------------------------------
 .../generate_provider_feature_matrix_table.py   | 24 +++++++++-----------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/830fbd87/contrib/generate_provider_feature_matrix_table.py
----------------------------------------------------------------------
diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index 08b3925..34e6694 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -55,16 +55,14 @@ from libcloud.backup.providers import get_driver as get_backup_driver
 from libcloud.backup.providers import DRIVERS as BACKUP_DRIVERS
 from libcloud.backup.types import Provider as BackupProvider
 
-REQUIRED_DEPENDENCIES = [
-    'pysphere'
-]
+try:
+    import pysphere  # noqa
+except ImportError:
+
+    class PySphere(object):
+        pass
 
-for dependency in REQUIRED_DEPENDENCIES:
-    try:
-        __import__(dependency)
-    except ImportError:
-        msg = 'Missing required dependency: %s' % (dependency)
-        raise ImportError(msg)
+    sys.modules['pysphere'] = PySphere
 
 HEADER = ('.. NOTE: This file has been generated automatically using '
           'generate_provider_feature_matrix_table.py script, don\'t manually '
@@ -299,9 +297,9 @@ def generate_providers_table(api):
             continue
 
         driver_methods = dict(inspect.getmembers(cls,
-                                                 predicate=inspect.ismethod))
+                                                 predicate=inspect.isfunction))
         base_methods = dict(inspect.getmembers(driver,
-                                               predicate=inspect.ismethod))
+                                               predicate=inspect.isfunction))
         base_api_methods = BASE_API_METHODS[api]
 
         result[name] = {'name': cls.name, 'website': cls.website,
@@ -318,8 +316,8 @@ def generate_providers_table(api):
                 features = getattr(cls, 'features', {}).get('create_node', [])
                 is_implemented = len(features) >= 1
             else:
-                is_implemented = (id(driver_method.im_func) !=
-                                  id(base_method.im_func))
+                is_implemented = (id(driver_method) !=
+                                  id(base_method))
 
             result[name]['methods'][method_name] = is_implemented
 


Mime
View raw message