diff options
author | Greg Ward <gward@python.net> | 2000-09-30 17:47:17 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-09-30 17:47:17 (GMT) |
commit | 963cd2d85d26467f60a3c03b5025fddfff0cd80c (patch) | |
tree | db7a54e5ae45e4f9496c1a5b92e1c9b34aca44ef /Lib/distutils/dir_util.py | |
parent | 3e6d43801b9d8ec5e73588f52bac660e14257160 (diff) | |
download | cpython-963cd2d85d26467f60a3c03b5025fddfff0cd80c.zip cpython-963cd2d85d26467f60a3c03b5025fddfff0cd80c.tar.gz cpython-963cd2d85d26467f60a3c03b5025fddfff0cd80c.tar.bz2 |
Andrew Kuchling: changed so the '_path_created' dictionary is keyed on
absolute pathnames; this lets it keep working in the face of chdir'ing
around.
Diffstat (limited to 'Lib/distutils/dir_util.py')
-rw-r--r-- | Lib/distutils/dir_util.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py index 768cb4e..a1578be 100644 --- a/Lib/distutils/dir_util.py +++ b/Lib/distutils/dir_util.py @@ -44,7 +44,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0): created_dirs = [] if os.path.isdir(name) or name == '': return created_dirs - if _path_created.get(name): + if _path_created.get(os.path.abspath(name)): return created_dirs (head, tail) = os.path.split(name) @@ -64,7 +64,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): + abs_head = os.path.abspath(head) + + if _path_created.get(abs_head): continue if verbose: @@ -78,7 +80,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0): raise DistutilsFileError, \ "could not create '%s': %s" % (head, exc[-1]) - _path_created[head] = 1 + _path_created[abs_head] = 1 return created_dirs # mkpath () @@ -208,8 +210,9 @@ def remove_tree (directory, verbose=0, dry_run=0): try: apply(cmd[0], (cmd[1],)) # remove dir from cache if it's already there - if _path_created.has_key(cmd[1]): - del _path_created[cmd[1]] + abspath = os.path.abspath(cmd[1]) + if _path_created.has_key(abspath): + del _path_created[abspath] except (IOError, OSError), exc: if verbose: print grok_environment_error( |