Preserve file metadata (esp. timestamps) when copy static files to output folder.

This commit is contained in:
zhouji 2013-10-15 10:37:03 +08:00
commit eb6d4bb008
2 changed files with 3 additions and 3 deletions

View file

@ -289,7 +289,7 @@ def copy(path, source, destination, destination_path=None):
else:
shutil.copytree(entry_path, entry_dest)
else:
shutil.copy(entry_path, destination)
shutil.copy2(entry_path, destination)
if os.path.isdir(source_):
@ -299,7 +299,7 @@ def copy(path, source, destination, destination_path=None):
dest_dir = os.path.dirname(destination_)
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy(source_, destination_)
shutil.copy2(source_, destination_)
logger.info('copying %s to %s' % (source_, destination_))
else:
logger.warning('skipped copy %s to %s' % (source_, destination_))