mirror of
https://github.com/django/django.git
synced 2025-03-31 19:46:42 +00:00
Removed shutil.copystat copied from stdlib (added to support an old Python?).
This commit is contained in:
parent
6571ed14b6
commit
426ead27bd
@ -6,21 +6,10 @@ Move a file in the safest way possible::
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from shutil import copystat
|
||||||
|
|
||||||
from django.core.files import locks
|
from django.core.files import locks
|
||||||
|
|
||||||
try:
|
|
||||||
from shutil import copystat
|
|
||||||
except ImportError:
|
|
||||||
import stat
|
|
||||||
|
|
||||||
def copystat(src, dst):
|
|
||||||
"""Copy all stat info (mode bits, atime and mtime) from src to dst"""
|
|
||||||
st = os.stat(src)
|
|
||||||
mode = stat.S_IMODE(st.st_mode)
|
|
||||||
if hasattr(os, 'utime'):
|
|
||||||
os.utime(dst, (st.st_atime, st.st_mtime))
|
|
||||||
if hasattr(os, 'chmod'):
|
|
||||||
os.chmod(dst, mode)
|
|
||||||
|
|
||||||
__all__ = ['file_move_safe']
|
__all__ = ['file_move_safe']
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user