]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
setup: show-tool-versions: emit module and __version__ information even when module...
authorZooko O'Whielacronx <zooko@zooko.com>
Sat, 30 Oct 2010 07:02:33 +0000 (00:02 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sat, 30 Oct 2010 07:02:33 +0000 (00:02 -0700)
misc/build_helpers/show-tool-versions.py

index 45b1645bfb7580971cc9ff8de270c78c613977be..ed23f8dbd7f87a14cc9c497a58fa698001d74a94 100644 (file)
@@ -94,7 +94,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
@@ -110,6 +113,17 @@ def print_py_pkg_ver(pkgname):
         traceback.print_exc(file=sys.stderr)
         sys.stderr.flush()
         pass
+    try:
+        __import__(modulename)
+    except ImportError:
+        pass
+    else:
+        modobj = sys.modules.get(modulename)
+        print pkgname + ' module: ' + str(modobj)
+        try:
+            print pkgname + ' __version__: ' + str(modobj.__version__)
+        except AttributeError:
+            pass
 
 print_platform()
 
@@ -139,3 +153,7 @@ print_py_pkg_ver('pyflakes')
 print_py_pkg_ver('zope.interface')
 print_py_pkg_ver('setuptools_darcs')
 print_py_pkg_ver('darcsver')
+print_py_pkg_ver('Twisted', 'twisted')
+print_py_pkg_ver('TwistedCore', 'twisted.python')
+print_py_pkg_ver('TwistedWeb', 'twisted.web')
+print_py_pkg_ver('TwistedConch', 'twisted.conch')