mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Preserve file metadata (esp. timestamps) when copy static files to output folder.
This commit is contained in:
parent
754611180b
commit
eb6d4bb008
2 changed files with 3 additions and 3 deletions
|
|
@ -573,7 +573,7 @@ class StaticGenerator(Generator):
|
||||||
source_path = os.path.join(self.path, sc.source_path)
|
source_path = os.path.join(self.path, sc.source_path)
|
||||||
save_as = os.path.join(self.output_path, sc.save_as)
|
save_as = os.path.join(self.output_path, sc.save_as)
|
||||||
mkdir_p(os.path.dirname(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))
|
logger.info('copying {} to {}'.format(sc.source_path, sc.save_as))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ def copy(path, source, destination, destination_path=None):
|
||||||
else:
|
else:
|
||||||
shutil.copytree(entry_path, entry_dest)
|
shutil.copytree(entry_path, entry_dest)
|
||||||
else:
|
else:
|
||||||
shutil.copy(entry_path, destination)
|
shutil.copy2(entry_path, destination)
|
||||||
|
|
||||||
|
|
||||||
if os.path.isdir(source_):
|
if os.path.isdir(source_):
|
||||||
|
|
@ -299,7 +299,7 @@ def copy(path, source, destination, destination_path=None):
|
||||||
dest_dir = os.path.dirname(destination_)
|
dest_dir = os.path.dirname(destination_)
|
||||||
if not os.path.exists(dest_dir):
|
if not os.path.exists(dest_dir):
|
||||||
os.makedirs(dest_dir)
|
os.makedirs(dest_dir)
|
||||||
shutil.copy(source_, destination_)
|
shutil.copy2(source_, destination_)
|
||||||
logger.info('copying %s to %s' % (source_, destination_))
|
logger.info('copying %s to %s' % (source_, destination_))
|
||||||
else:
|
else:
|
||||||
logger.warning('skipped copy %s to %s' % (source_, destination_))
|
logger.warning('skipped copy %s to %s' % (source_, destination_))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue