#205: When copying files, don't copy full stat info, only

modification times.
This commit is contained in:
Georg Brandl 2009-08-06 21:22:12 +02:00
parent b242c6b47c
commit efa16ae0c7
2 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,9 @@
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.
* Properly format bullet lists nested in definition lists for LaTeX.

View File

@ -12,6 +12,7 @@
import os
import re
import sys
import stat
import time
import types
import shutil
@ -399,11 +400,22 @@ def movefile(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):
"""Copy a file and its modification times, if possible."""
shutil.copyfile(source, dest)
try: shutil.copystat(source, dest)
except shutil.Error: pass
try:
# 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={}):