mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use `shutil.copy2()
` on Windows for better performance
This commit is contained in:
parent
2ebb995784
commit
3c6ccd38c9
@ -133,10 +133,14 @@ def copyfile(
|
||||
logger.warning(msg, source, dest, type='misc', subtype='copy_overwrite')
|
||||
return
|
||||
|
||||
shutil.copyfile(source, dest)
|
||||
with contextlib.suppress(OSError):
|
||||
# don't do full copystat because the source may be read-only
|
||||
_copy_times(source, dest)
|
||||
if sys.platform == 'win32':
|
||||
# copy2() uses Windows API calls
|
||||
shutil.copy2(source, dest)
|
||||
else:
|
||||
shutil.copyfile(source, dest)
|
||||
with contextlib.suppress(OSError):
|
||||
# don't do full copystat because the source may be read-only
|
||||
_copy_times(source, dest)
|
||||
|
||||
|
||||
_no_fn_re = re.compile(r'[^a-zA-Z0-9_-]')
|
||||
|
Loading…
Reference in New Issue
Block a user