From: Daira Hopwood Date: Fri, 26 Dec 2014 22:29:42 +0000 (+0000) Subject: Latest cryptography depends on enum34. X-Git-Tag: allmydata-tahoe-1.10.1a1~83 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/class-simplejson.JSONEncoder-index.html?a=commitdiff_plain;h=e73d76eb1b8751b1669e380c82c7ce5065faddad;p=tahoe-lafs%2Ftahoe-lafs.git Latest cryptography depends on enum34. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index e07f73c2..44f971f8 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -188,8 +188,17 @@ def get_package_versions_and_locations(): packages = [] - def get_version(module, attr): - return str(getattr(module, attr, 'unknown')) + def get_version(module): + if hasattr(module, '__version__'): + return str(getattr(module, '__version__')) + elif hasattr(module, 'version'): + ver = getattr(module, 'version') + if isinstance(ver, tuple): + return '.'.join(map(str, ver)) + else: + return str(ver) + else: + return 'unknown' for pkgname, modulename in [(__appname__, 'allmydata')] + package_imports: if modulename: @@ -207,7 +216,7 @@ def get_package_versions_and_locations(): elif pkgname == 'setuptools' and hasattr(module, '_distribute'): # distribute does not report its version in any module variables comment = 'distribute' - packages.append( (pkgname, (get_version(module, '__version__'), package_dir(module.__file__), comment)) ) + packages.append( (pkgname, (get_version(module), package_dir(module.__file__), comment)) ) elif pkgname == 'python': packages.append( (pkgname, (platform.python_version(), sys.executable, None)) ) elif pkgname == 'platform': diff --git a/src/allmydata/_auto_deps.py b/src/allmydata/_auto_deps.py index b3f2f2e8..7a8a1854 100644 --- a/src/allmydata/_auto_deps.py +++ b/src/allmydata/_auto_deps.py @@ -204,6 +204,7 @@ if _can_use_pyOpenSSL_0_14: "cryptography", "cffi >= 0.8", # latest cryptography depends on this version "six >= 1.4.1", # latest cryptography depends on this version + "enum34", # latest cryptography depends on this "pycparser", # cffi depends on this ] @@ -211,6 +212,7 @@ if _can_use_pyOpenSSL_0_14: ('cryptography', 'cryptography'), ('cffi', 'cffi'), ('six', 'six'), + ('enum34', 'enum'), ('pycparser', 'pycparser'), ] else: