From: zooko Date: Sat, 30 Oct 2010 06:59:13 +0000 (+0530) Subject: setup: show-tool-versions: emit module and __version__ information even when module... X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg?a=commitdiff_plain;h=1ea1dd08165697516a2ee32cca702237c48a7fe3;p=tahoe-lafs%2Fzfec.git setup: show-tool-versions: emit module and __version__ information even when module name != distribution (package) name, and add TwistedCore Ignore-this: 93c1d7e5062a85a27d5b3df91d13d86f darcs-hash:22685813d4d1ca719250b2842ba6a72a26ae479e --- diff --git a/misc/build_helpers/show-tool-versions.py b/misc/build_helpers/show-tool-versions.py index b8f7747..d3b3153 100755 --- a/misc/build_helpers/show-tool-versions.py +++ b/misc/build_helpers/show-tool-versions.py @@ -66,7 +66,10 @@ def print_setuptools_ver(): sys.stderr.flush() pass -def print_py_pkg_ver(pkgname): +def print_py_pkg_ver(pkgname, modulename=None): + if modulename is None: + modulename = pkgname + print try: import pkg_resources @@ -83,11 +86,11 @@ def print_py_pkg_ver(pkgname): sys.stderr.flush() pass try: - __import__(pkgname) + __import__(modulename) except ImportError: pass else: - modobj = sys.modules.get(pkgname) + modobj = sys.modules.get(modulename) print pkgname + ' module: ' + str(modobj) try: print pkgname + ' __version__: ' + str(modobj.__version__) @@ -113,5 +116,5 @@ print_py_pkg_ver('trialcoverage') print_py_pkg_ver('setuptools_trial') print_py_pkg_ver('setuptools_darcs') print_py_pkg_ver('darcsver') -print_py_pkg_ver('twisted') -print_py_pkg_ver('TwistedCore') +print_py_pkg_ver('Twisted', 'twisted') +print_py_pkg_ver('TwistedCore', 'twisted.python')