Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f585574

Browse files
committed
Corran Webster: fix 'change_root()' to handle Mac OS paths.
1 parent 55a8338 commit f585574

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/distutils/util.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ def change_root (new_root, pathname):
100100
return os.path.join (new_root, path)
101101

102102
elif os.name == 'mac':
103-
raise RuntimeError, "no clue how to do this on Mac OS"
103+
if not os.path.isabs(pathname):
104+
return os.path.join(new_root, pathname)
105+
else:
106+
# Chop off volume name from start of path
107+
elements = string.split(pathname, ":", 1)
108+
pathname = ":" + elements[1]
109+
return os.path.join(new_root, pathname)
104110

105111
else:
106112
raise DistutilsPlatformError, \

0 commit comments

Comments
 (0)