]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
misc/build_helpers/show-tool-versions.py: if we can't import pkg_resources, insert...
authordavid-sarah <david-sarah@jacaranda.org>
Sat, 6 Nov 2010 22:44:04 +0000 (14:44 -0800)
committerdavid-sarah <david-sarah@jacaranda.org>
Sat, 6 Nov 2010 22:44:04 +0000 (14:44 -0800)
misc/build_helpers/show-tool-versions.py

index f7434e47256c6e5cdcdf9cc21522a986d5b03265..4b545b519251cc579c108983810d730ee85e16c7 100644 (file)
@@ -2,6 +2,18 @@
 
 import locale, os, subprocess, sys, traceback
 
+added_zetuptoolz_egg = False
+try:
+    import pkg_resources
+except ImportError:
+    import glob
+    eggz = glob.glob(os.path.join('..', 'setuptools-*.egg'))
+    if len(eggz) > 0:
+        egg = os.path.realpath(eggz[0])
+        print >>sys.stderr, "Inserting egg on sys.path: %r" % (egg,)
+        added_zetuptoolz_egg = True
+        sys.path.insert(0, egg)
+
 def foldlines(s):
     return s.replace("\n", " ").replace("\r", "")
 
@@ -85,6 +97,10 @@ def print_as_ver():
 
 def print_setuptools_ver():
     print
+    if added_zetuptoolz_egg:
+        # it would be misleading to report the bundled version of zetuptoolz as the installed version
+        print "setuptools: using bundled egg"
+        return
     try:
         import pkg_resources
         out = str(pkg_resources.require("setuptools"))