Show More
@@ -806,8 +806,9 b' def checksignature(func):' | |||||
806 |
|
806 | |||
807 | return check |
|
807 | return check | |
808 |
|
808 | |||
809 | def copyfile(src, dest, hardlink=False): |
|
809 | def copyfile(src, dest, hardlink=False, copystat=False): | |
810 |
|
|
810 | '''copy a file, preserving mode and optionally other stat info like | |
|
811 | atime/mtime''' | |||
811 | if os.path.lexists(dest): |
|
812 | if os.path.lexists(dest): | |
812 | unlink(dest) |
|
813 | unlink(dest) | |
813 | # hardlinks are problematic on CIFS, quietly ignore this flag |
|
814 | # hardlinks are problematic on CIFS, quietly ignore this flag | |
@@ -820,9 +821,15 b' def copyfile(src, dest, hardlink=False):' | |||||
820 | pass # fall back to normal copy |
|
821 | pass # fall back to normal copy | |
821 | if os.path.islink(src): |
|
822 | if os.path.islink(src): | |
822 | os.symlink(os.readlink(src), dest) |
|
823 | os.symlink(os.readlink(src), dest) | |
|
824 | # copytime is ignored for symlinks, but in general copytime isn't needed | |||
|
825 | # for them anyway | |||
823 | else: |
|
826 | else: | |
824 | try: |
|
827 | try: | |
825 | shutil.copyfile(src, dest) |
|
828 | shutil.copyfile(src, dest) | |
|
829 | if copystat: | |||
|
830 | # copystat also copies mode | |||
|
831 | shutil.copystat(src, dest) | |||
|
832 | else: | |||
826 | shutil.copymode(src, dest) |
|
833 | shutil.copymode(src, dest) | |
827 | except shutil.Error as inst: |
|
834 | except shutil.Error as inst: | |
828 | raise Abort(str(inst)) |
|
835 | raise Abort(str(inst)) |
General Comments 0
You need to be logged in to leave comments.
Login now