Issue 2051: Support execution when installed via easy_install.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 21 Feb 2010 14:57:09 +0000 (14:57 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 21 Feb 2010 14:57:09 +0000 (14:57 +0000)
(Gottfried Ganssauge)

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4680 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/script/scons.py
src/script/sconsign.py

index ec6ea95378d488b6279fbaef13b97d6ce838fad5..3a1b8e3dbc0f5c8bd7813c48ea33945c151bcb9e 100644 (file)
@@ -14,6 +14,10 @@ RELEASE X.X.X - XXX
 
     - Fix typos in the man page.
 
+  From Gottfried Ganssauge:
+
+    - Support execution when SCons is installed via easy_install.
+
   From Steven Knight:
 
     - Make the messages for Configure checks of compilers consistent.
index fb4cf525691ff05b583afe7f77dc117abea6a64d..dec422299078906761b71f720e2c2cc386f4da31 100644 (file)
@@ -160,6 +160,19 @@ else:
         # Check /usr/libfoo/scons*.
         prefs.append(libpath)
 
+    try:
+        import pkg_resources
+    except ImportError:
+        pass
+    else:
+        # when running from an egg add the egg's directory 
+        try:
+            d = pkg_resources.get_distribution('scons')
+        except pkg_resources.DistributionNotFound:
+            pass
+        else:
+            prefs.append(d.location)
+
 # Look first for 'scons-__version__' in all of our preference libs,
 # then for 'scons'.
 libs.extend(map(lambda x: os.path.join(x, scons_version), prefs))
index c45f58731a4e9be1887e47886ffa8500549d4851..40c5daff1f0bb732c16c5df6ba3bfd1a4170948d 100644 (file)
@@ -148,6 +148,19 @@ else:
         # Check /usr/libfoo/scons*.
         prefs.append(libpath)
 
+    try:
+        import pkg_resources
+    except ImportError:
+        pass
+    else:
+        # when running from an egg add the egg's directory 
+        try:
+            d = pkg_resources.get_distribution('scons')
+        except pkg_resources.DistributionNotFound:
+            pass
+        else:
+            prefs.append(d.location)
+
 # Look first for 'scons-__version__' in all of our preference libs,
 # then for 'scons'.
 libs.extend(map(lambda x: os.path.join(x, scons_version), prefs))