Only copy the file and the atime and mtime when installing from Wheel

This commit is contained in:
Donald Stufft 2014-11-20 11:17:42 -05:00
parent 1da8b75bf7
commit 0fa67d9ffc
1 changed files with 14 additions and 4 deletions

View File

@ -200,10 +200,20 @@ def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
# uninstalled.
if not os.path.exists(destdir):
os.makedirs(destdir)
# use copy2 (not move) to be extra sure we're not moving
# directories over; copy2 fails for directories. this would
# fail tests (not during released/user execution)
shutil.copy2(srcfile, destfile)
# We use copyfile (not move, copy, or copy2) to be extra sure
# that we are not moving directories over (copyfile fails for
# directories) as well as to ensure that we are not copying
# over any metadata because we want more control over what
# metadata we actually copy over.
shutil.copyfile(srcfile, destfile)
# Copy over the metadata for the file, currently this only
# includes the atime and mtime.
st = os.stat(srcfile)
if hasattr(os, "utime"):
os.utime(destfile, (st.st_atime, st.st_mtime))
changed = False
if fixer:
changed = fixer(destfile)