summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-05-31 02:14:32 (GMT)
committerGreg Ward <gward@python.net>2000-05-31 02:14:32 (GMT)
commit4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b (patch)
tree50b3ef6fbf56ddd123aa0f752b361f5589bc4dea /Lib/distutils/util.py
parenta76bbd4566dce750c22df7f1e9e5bcc24e295aaf (diff)
downloadcpython-4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b.zip
cpython-4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b.tar.gz
cpython-4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b.tar.bz2
Fixed 'change_root() to work at all on Windows, and to work correctly on Unix.
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index b660b4b..6063aa6 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -86,22 +86,22 @@ def native_path (pathname):
def change_root (new_root, pathname):
-
"""Return 'pathname' with 'new_root' prepended. If 'pathname' is
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 not abspath (pathname):
- return os.path.join (new_root, pathname)
-
- elif os.name == 'posix':
- return os.path.join (new_root, pathname[1:])
+ two, which is tricky on DOS/Windows and Mac OS.
+ """
+ if os.name == 'posix':
+ if not os.path.isabs (pathname):
+ return os.path.join (new_root, pathname)
+ else:
+ return os.path.join (new_root, pathname[1:])
elif os.name == 'nt':
- (root_drive, root_path) = os.path.splitdrive (new_root)
(drive, path) = os.path.splitdrive (pathname)
- raise RuntimeError, "I give up -- not sure how to do this on Windows"
+ if path[0] == '\\':
+ path = path[1:]
+ return os.path.join (new_root, path)
elif os.name == 'mac':
raise RuntimeError, "no clue how to do this on Mac OS"