Show More
@@ -36,6 +36,8 b" osutil = policy.importmod('osutil')" | |||
|
36 | 36 | |
|
37 | 37 | normpath = os.path.normpath |
|
38 | 38 | samestat = os.path.samestat |
|
39 | abspath = os.path.abspath # re-exports | |
|
40 | ||
|
39 | 41 | try: |
|
40 | 42 | oslink = os.link |
|
41 | 43 | except AttributeError: |
@@ -99,6 +99,7 b' else:' | |||
|
99 | 99 | |
|
100 | 100 | _ = i18n._ |
|
101 | 101 | |
|
102 | abspath = platform.abspath | |
|
102 | 103 | bindunixsocket = platform.bindunixsocket |
|
103 | 104 | cachestat = platform.cachestat |
|
104 | 105 | checkexec = platform.checkexec |
@@ -2632,7 +2633,7 b' def makedirs(name, mode=None, notindexed' | |||
|
2632 | 2633 | return |
|
2633 | 2634 | if err.errno != errno.ENOENT or not name: |
|
2634 | 2635 | raise |
|
2635 |
parent = os.path.dirname( |
|
|
2636 | parent = os.path.dirname(abspath(name)) | |
|
2636 | 2637 | if parent == name: |
|
2637 | 2638 | raise |
|
2638 | 2639 | makedirs(parent, mode, notindexed) |
@@ -333,6 +333,25 b' def normcase(path):' | |||
|
333 | 333 | return encoding.upper(path) # NTFS compares via upper() |
|
334 | 334 | |
|
335 | 335 | |
|
336 | DRIVE_RE_B = re.compile(b'^[a-z]:') | |
|
337 | DRIVE_RE_S = re.compile('^[a-z]:') | |
|
338 | ||
|
339 | ||
|
340 | def abspath(path): | |
|
341 | abs_path = os.path.abspath(path) # re-exports | |
|
342 | # Python on Windows is inconsistent regarding the capitalization of drive | |
|
343 | # letter and this cause issue with various path comparison along the way. | |
|
344 | # So we normalize the drive later to upper case here. | |
|
345 | # | |
|
346 | # See https://bugs.python.org/issue40368 for and example of this hell. | |
|
347 | if isinstance(abs_path, bytes): | |
|
348 | if DRIVE_RE_B.match(abs_path): | |
|
349 | abs_path = abs_path[0:1].upper() + abs_path[1:] | |
|
350 | elif DRIVE_RE_S.match(abs_path): | |
|
351 | abs_path = abs_path[0:1].upper() + abs_path[1:] | |
|
352 | return abs_path | |
|
353 | ||
|
354 | ||
|
336 | 355 | # see posix.py for definitions |
|
337 | 356 | normcasespec = encoding.normcasespecs.upper |
|
338 | 357 | normcasefallback = encoding.upperfallback |
General Comments 0
You need to be logged in to leave comments.
Login now