Commit 926d45bb authored by Johannes Gijsbers's avatar Johannes Gijsbers

shutil.copytree: move copystat call for the directory after the loop

copying files inside the directory, as that loop changes the atime and
mtime.
parent 8e3ca8af
...@@ -109,7 +109,6 @@ def copytree(src, dst, symlinks=False): ...@@ -109,7 +109,6 @@ def copytree(src, dst, symlinks=False):
""" """
names = os.listdir(src) names = os.listdir(src)
os.makedirs(dst) os.makedirs(dst)
copystat(src, dst)
errors = [] errors = []
for name in names: for name in names:
srcname = os.path.join(src, name) srcname = os.path.join(src, name)
...@@ -125,6 +124,7 @@ def copytree(src, dst, symlinks=False): ...@@ -125,6 +124,7 @@ def copytree(src, dst, symlinks=False):
# XXX What about devices, sockets etc.? # XXX What about devices, sockets etc.?
except (IOError, os.error), why: except (IOError, os.error), why:
errors.append((srcname, dstname, why)) errors.append((srcname, dstname, why))
copystat(src, dst)
if errors: if errors:
raise Error, errors raise Error, errors
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment