| diff -Naur Python-2.7.9-orig/Lib/distutils/command/install.py Python-2.7.9/Lib/distutils/command/install.py |
| --- Python-2.7.9-orig/Lib/distutils/command/install.py 2014-12-10 18:59:34.000000000 +0300 |
| +++ Python-2.7.9/Lib/distutils/command/install.py 2014-12-11 13:50:58.983800000 +0300 |
| @@ -348,7 +348,8 @@ |
| |
| # Convert directories from Unix /-separated syntax to the local |
| # convention. |
| - self.convert_paths('lib', 'purelib', 'platlib', |
| + self.convert_paths('base', 'platbase', |
| + 'lib', 'purelib', 'platlib', |
| 'scripts', 'data', 'headers', |
| 'userbase', 'usersite') |
| |
| diff -Naur Python-2.7.9-orig/Lib/distutils/util.py Python-2.7.9/Lib/distutils/util.py |
| --- Python-2.7.9-orig/Lib/distutils/util.py 2014-12-11 13:50:16.614200000 +0300 |
| +++ Python-2.7.9/Lib/distutils/util.py 2014-12-11 13:50:58.983800000 +0300 |
| @@ -132,6 +132,13 @@ |
| paths.remove('.') |
| if not paths: |
| return os.curdir |
| + # On Windows, if paths is ['C:','folder','subfolder'] then |
| + # os.path.join(*paths) will return 'C:folder\subfolder' which |
| + # is thus relative to the CWD on that drive. So we work around |
| + # this by adding a \ to path[0] |
| + if (len(paths) > 0 and paths[0].endswith(':') and |
| + sys.platform == "win32" and sys.version.find("GCC") >= 0): |
| + paths[0] += '\\' |
| return os.path.join(*paths) |
| |
| # convert_path () |
| @@ -142,6 +149,10 @@ |
| relative, this is equivalent to "os.path.join(new_root,pathname)". |
| Otherwise, it requires making 'pathname' relative and then joining the |
| two, which is tricky on DOS/Windows and Mac OS. |
| + |
| + If on Windows or OS/2 and both new_root and pathname are on different |
| + drives, raises DistutilsChangeRootError as this is nonsensical, |
| + otherwise use drive which can be in either of new_root or pathname. |
| """ |
| if os.name == 'posix': |
| if not os.path.isabs(pathname): |
| @@ -149,17 +160,22 @@ |
| else: |
| return os.path.join(new_root, pathname[1:]) |
| |
| - elif os.name == 'nt': |
| - (drive, path) = os.path.splitdrive(pathname) |
| - if path[0] == '\\': |
| - path = path[1:] |
| - return os.path.join(new_root, path) |
| - |
| - elif os.name == 'os2': |
| + elif os.name == 'nt' or os.name == 'os2': |
| (drive, path) = os.path.splitdrive(pathname) |
| if path[0] == os.sep: |
| path = path[1:] |
| - return os.path.join(new_root, path) |
| + (drive_r, path_r) = os.path.splitdrive(new_root) |
| + if path_r and path_r[0] == os.sep: |
| + path_r = path_r[1:] |
| + drive_used = '' |
| + if len(drive) == 2 and len(drive_r) == 2 and drive != drive_r: |
| + raise DistutilsChangeRootError("root and pathname not on same drive (%s, %s)" |
| + % (drive_r,drive)) |
| + elif len(drive_r) == 2: |
| + drive_used = drive_r+os.sep |
| + elif len(drive) == 2: |
| + drive_used = drive+os.sep |
| + return os.path.join(drive_used+path_r, path) |
| |
| else: |
| raise DistutilsPlatformError, \ |
| diff -Naur Python-2.7.9-orig/Makefile.pre.in Python-2.7.9/Makefile.pre.in |
| --- Python-2.7.9-orig/Makefile.pre.in 2014-12-11 13:50:51.012200000 +0300 |
| +++ Python-2.7.9/Makefile.pre.in 2014-12-11 13:50:58.999400000 +0300 |
| @@ -1194,6 +1194,12 @@ |
| ;; \ |
| esac |
| |
| +ifeq ($(shell uname -o),Msys) |
| +DESTDIRFINAL=$(DESTDIR) |
| +else |
| +DESTDIRFINAL=$(DESTDIR)/ |
| +endif |
| + |
| # Install the dynamically loadable modules |
| # This goes into $(exec_prefix) |
| sharedinstall: sharedmods |
| @@ -1201,8 +1207,8 @@ |
| --prefix=$(prefix) \ |
| --install-scripts=$(BINDIR) \ |
| --install-platlib=$(DESTSHARED) \ |
| - --root=$(DESTDIR)/ |
| - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py* |
| + --root=$(DESTDIRFINAL) |
| + -rm $(DESTDIRFINAL)$(DESTSHARED)/_sysconfigdata.py |
| |
| # Here are a couple of targets for MacOSX again, to install a full |
| # framework-based Python. frameworkinstall installs everything, the |
| @@ -1274,7 +1280,7 @@ |
| $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \ |
| --prefix=$(prefix) \ |
| --install-scripts=$(BINDIR) \ |
| - --root=$(DESTDIR)/ |
| + --root=$(DESTDIRFINAL) |
| |
| # Build the toplevel Makefile |
| Makefile.pre: Makefile.pre.in config.status |