Commits

anatoly techtonik committed e5b23d2

Backport fix for #2051 from trunk/ to allow installation from 1.3 branch
with easy_install on Windows

  • Participants
  • Parent commits bcb6284
  • Branches 2.0

Comments (0)

Files changed (6)

     ]
 
     for script in scripts:
-        #commands.append("mv %s/%s %s/%s.py" % (local, script, local, script))
+        # add .py extension for scons-local scripts on non-windows platforms
+        if platform == "win32":
+            break
         local_script = os.path.join(build_dir_local, script)
         commands.append(Move(local_script + '.py', local_script))
 

File src/CHANGES.txt

                             Change Log
 
 
+  From Anatoly Techtonik:
+
+    - Fix broken installation with easy_install on Windows (issue #2051)
+      SCons traditionally installed in a way that allowed to run multiple
+      versions side by side. This custom logic was incompatible with
+      easy_install way of doing things.
+
 RELEASE 2.0.1 - Mon, 15 Aug 2010 15:46:32 -0700
 
   From Dirk Baechle:

File src/script/scons.bat

 setlocal
 @REM ensure the script will be executed with the Python it was installed for
 set path=%~dp0;%~dp0..;%path%
-python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-__VERSION__'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %*
+@REM try the script named as the .bat file in current dir, then in Scripts subdir
+set scriptname=%~dp0%~n0.py
+if not exist %scriptname% set scriptname=%~dp0Scripts\%~n0.py
+python "%scriptname%" %*
 endlocal & set SCONS_ERRORLEVEL=%ERRORLEVEL%
 
 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto returncode

File src/script/scons.py

 
 scons_version = 'scons-%s' % __version__
 
+# preferred order of scons lookup paths
 prefs = []
 
+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)
+
 if sys.platform == 'win32':
     # sys.prefix is (likely) C:\Python*;
     # check only C:\Python*.
         # 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([os.path.join(x, scons_version) for x in prefs])

File src/script/sconsign.py

 
 scons_version = 'scons-%s' % __version__
 
+# preferred order of scons lookup paths
 prefs = []
 
+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)
+
 if sys.platform == 'win32':
     # sys.prefix is (likely) C:\Python*;
     # check only C:\Python*.
         # 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([os.path.join(x, scons_version) for x in prefs])

File src/setup.py

     os.chdir(head)
     sys.argv[0] = tail
 
+
+# flag if setup.py is run on win32 or _for_ win32 platform,
+# (when building windows installer on linux, for example)
 is_win32 = 0
 if not sys.platform == 'win32':
     try:
             base = os.path.basename(src)
             scons = os.path.join(self.install_dir, base)
             scons_ver = scons + '-' + Version
+            if is_win32:
+                scons += '.py'
+                scons_ver += '.py'
             create_version_script(src, scons_ver)
             create_basename_script(src, scons, scons_ver)