@@ -477,7 +477,7 @@ def _ignore_patterns(path, names):
477
477
return _ignore_patterns
478
478
479
479
def _copytree (entries , src , dst , symlinks , ignore , copy_function ,
480
- ignore_dangling_symlinks , dirs_exist_ok = False ):
480
+ ignore_dangling_symlinks , dirs_exist_ok = False , copy_stat = True ):
481
481
if ignore is not None :
482
482
ignored_names = ignore (os .fspath (src ), [x .name for x in entries ])
483
483
else :
@@ -533,7 +533,8 @@ def _copytree(entries, src, dst, symlinks, ignore, copy_function,
533
533
except OSError as why :
534
534
errors .append ((srcname , dstname , str (why )))
535
535
try :
536
- copystat (src , dst )
536
+ if copy_stat == True :
537
+ copystat (src , dst )
537
538
except OSError as why :
538
539
# Copying file access times may fail on Windows
539
540
if getattr (why , 'winerror' , None ) is None :
@@ -543,7 +544,7 @@ def _copytree(entries, src, dst, symlinks, ignore, copy_function,
543
544
return dst
544
545
545
546
def copytree (src , dst , symlinks = False , ignore = None , copy_function = copy2 ,
546
- ignore_dangling_symlinks = False , dirs_exist_ok = False ):
547
+ ignore_dangling_symlinks = False , dirs_exist_ok = False , copy_stat = True ):
547
548
"""Recursively copy a directory tree and return the destination directory.
548
549
549
550
If exception(s) occur, an Error is raised with a list of reasons.
@@ -588,7 +589,7 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
588
589
return _copytree (entries = entries , src = src , dst = dst , symlinks = symlinks ,
589
590
ignore = ignore , copy_function = copy_function ,
590
591
ignore_dangling_symlinks = ignore_dangling_symlinks ,
591
- dirs_exist_ok = dirs_exist_ok )
592
+ dirs_exist_ok = dirs_exist_ok , copy_stat = copy_stat )
592
593
593
594
if hasattr (os .stat_result , 'st_file_attributes' ):
594
595
def _rmtree_islink (path ):
0 commit comments