summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>1999-09-29 12:14:16 (GMT)
committerGreg Ward <gward@python.net>1999-09-29 12:14:16 (GMT)
commitcd1486fff14888437837298ada405b13ce965217 (patch)
tree264067384d5565a47d941c270b504ab44cddcaa4 /Lib/distutils/util.py
parent3868eb97c814f22fadc32627bd19a6dc0afe5b85 (diff)
downloadcpython-cd1486fff14888437837298ada405b13ce965217.zip
cpython-cd1486fff14888437837298ada405b13ce965217.tar.gz
cpython-cd1486fff14888437837298ada405b13ce965217.tar.bz2
More tweaks to 'mkpath()':
- deal with empty tail from os.path.split() (eg. from trailing slash, or backslash, or whatever) - check PATH_CREATED hash inside loop as well
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 85b04e7..aee95d3 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -43,6 +43,8 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
return
(head, tail) = os.path.split (name)
+ if not tail: # in case 'name' has trailing slash
+ (head, tail) = os.path.split (head)
tails = [tail] # stack of lone dirs to create
while head and tail and not os.path.isdir (head):
@@ -59,6 +61,9 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
for d in tails:
#print "head = %s, d = %s: " % (head, d),
head = os.path.join (head, d)
+ if PATH_CREATED.get (head):
+ continue
+
if verbose:
print "creating", head