]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
On David Ascher's recommendation: reversed order of 'utime()' and
authorGreg Ward <gward@python.net>
Tue, 8 Jun 1999 17:05:21 +0000 (17:05 +0000)
committerGreg Ward <gward@python.net>
Tue, 8 Jun 1999 17:05:21 +0000 (17:05 +0000)
'chmod()' in 'copy_file()'.

Lib/distutils/util.py

index 7aedc1c6df8f2f6dbaefe83cb2e8b339f3df6bd6..9a299dfd8395dd2a86085b3e4fd584f12e8cdfca 100644 (file)
@@ -198,10 +198,13 @@ def copy_file (src, dst,
     _copy_file_contents (src, dst)
     if preserve_mode or preserve_times:
         st = os.stat (src)
-        if preserve_mode:
-            os.chmod (dst, S_IMODE (st[ST_MODE]))
+
+        # According to David Ascher <da@ski.org>, utime() should be done
+        # before chmod() (at least under NT).
         if preserve_times:
             os.utime (dst, (st[ST_ATIME], st[ST_MTIME]))
+        if preserve_mode:
+            os.chmod (dst, S_IMODE (st[ST_MODE]))
 
     return 1