diff --git a/pelican/generators.py b/pelican/generators.py index d695c7c8..c55cdc37 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -573,7 +573,7 @@ class StaticGenerator(Generator): source_path = os.path.join(self.path, sc.source_path) save_as = os.path.join(self.output_path, sc.save_as) mkdir_p(os.path.dirname(save_as)) - shutil.copy(source_path, save_as) + shutil.copy2(source_path, save_as) logger.info('copying {} to {}'.format(sc.source_path, sc.save_as)) diff --git a/pelican/utils.py b/pelican/utils.py index f222f63c..4b25ec7f 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -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_))