mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
workaround for python issue28141; copystat fails on Android
This commit is contained in:
parent
d6ac93a470
commit
ecf509819c
2 changed files with 18 additions and 3 deletions
|
|
@ -728,7 +728,12 @@ class StaticGenerator(Generator):
|
|||
save_as = os.path.join(self.output_path, sc.save_as)
|
||||
mkdir_p(os.path.dirname(save_as))
|
||||
shutil.copy2(source_path, save_as)
|
||||
logger.info('Copying %s to %s', sc.source_path, sc.save_as)
|
||||
try:
|
||||
# workaround for Android python copy2 bug ([issue28141])
|
||||
shutil.copy2(source_path, save_as)
|
||||
except Exception as e:
|
||||
logger.error("A problem occurred copying file %s to %s; %s",
|
||||
source_path, save_as, e)
|
||||
|
||||
|
||||
class SourceFileGenerator(Generator):
|
||||
|
|
|
|||
|
|
@ -337,7 +337,12 @@ def copy(source, destination, ignores=None):
|
|||
logger.info('Creating directory %s', dst_dir)
|
||||
os.makedirs(dst_dir)
|
||||
logger.info('Copying %s to %s', source_, destination_)
|
||||
shutil.copy2(source_, destination_)
|
||||
try:
|
||||
# workaround for Android python copystat bug ([issue28141])
|
||||
shutil.copy2(source_, destination_)
|
||||
except Exception as e:
|
||||
logger.error("A problem occurred copying file %s to %s; %s",
|
||||
source_, destination_, e)
|
||||
|
||||
elif os.path.isdir(source_):
|
||||
if not os.path.exists(destination_):
|
||||
|
|
@ -367,7 +372,12 @@ def copy(source, destination, ignores=None):
|
|||
dst_path = os.path.join(dst_dir, o)
|
||||
if os.path.isfile(src_path):
|
||||
logger.info('Copying %s to %s', src_path, dst_path)
|
||||
shutil.copy2(src_path, dst_path)
|
||||
try:
|
||||
# workaround for Android python copystat bug ([issue28141])
|
||||
shutil.copy2(src_path, dst_path)
|
||||
except Exception as e:
|
||||
logger.error("A problem occurred copying file %s to %s; %s",
|
||||
src_path, dst_path, e)
|
||||
else:
|
||||
logger.warning('Skipped copy %s (not a file or '
|
||||
'directory) to %s',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue