mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#205: When copying files, don't copy full stat info, only
modification times.
This commit is contained in:
parent
b242c6b47c
commit
efa16ae0c7
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
|||||||
Release 0.6.3 (in development)
|
Release 0.6.3 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #205: When copying files, don't copy full stat info, only
|
||||||
|
modification times.
|
||||||
|
|
||||||
* #232: Support non-ASCII metadata in Qt help builder.
|
* #232: Support non-ASCII metadata in Qt help builder.
|
||||||
|
|
||||||
* Properly format bullet lists nested in definition lists for LaTeX.
|
* Properly format bullet lists nested in definition lists for LaTeX.
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import stat
|
||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
import shutil
|
import shutil
|
||||||
@ -399,11 +400,22 @@ def movefile(source, dest):
|
|||||||
os.rename(source, dest)
|
os.rename(source, dest)
|
||||||
|
|
||||||
|
|
||||||
|
def copytimes(source, dest):
|
||||||
|
"""Copy a file's modification times."""
|
||||||
|
st = os.stat(source)
|
||||||
|
mode = stat.S_IMODE(st.st_mode)
|
||||||
|
if hasattr(os, 'utime'):
|
||||||
|
os.utime(dest, (st.st_atime, st.st_mtime))
|
||||||
|
|
||||||
|
|
||||||
def copyfile(source, dest):
|
def copyfile(source, dest):
|
||||||
"""Copy a file and its modification times, if possible."""
|
"""Copy a file and its modification times, if possible."""
|
||||||
shutil.copyfile(source, dest)
|
shutil.copyfile(source, dest)
|
||||||
try: shutil.copystat(source, dest)
|
try:
|
||||||
except shutil.Error: pass
|
# don't do full copystat because the source may be read-only
|
||||||
|
copytimes(source, dest)
|
||||||
|
except shutil.Error:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def copy_static_entry(source, target, builder, context={}):
|
def copy_static_entry(source, target, builder, context={}):
|
||||||
|
Loading…
Reference in New Issue
Block a user