Skip to content

Commit 36a2941

Browse files
committed
Fix path separator issue in change_root function
use `os.sep` instead of hardcoding `\\` also, fix appropriate tests
1 parent 9e707f0 commit 36a2941

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

distutils/tests/test_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def _join(*path):
109109

110110
# windows
111111
os.name = 'nt'
112+
os.sep = '\\'
112113

113114
def _isabs(path):
114115
return path.startswith('c:\\')

distutils/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def change_root(new_root, pathname):
165165

166166
elif os.name == 'nt':
167167
(drive, path) = os.path.splitdrive(pathname)
168-
if path[0] == '\\':
168+
if path[0] == os.sep:
169169
path = path[1:]
170170
return os.path.join(new_root, path)
171171

0 commit comments

Comments
 (0)