]> granicus.if.org Git - python/commitdiff
Fixes handling of read-only files when creating zip package.
authorSteve Dower <steve.dower@microsoft.com>
Thu, 10 Sep 2015 02:32:45 +0000 (19:32 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Thu, 10 Sep 2015 02:32:45 +0000 (19:32 -0700)
Tools/msi/make_zip.py

index 09ee49166d98926a65547b487bc875c351c4c370..c256008acaa6dc514c3a9d70956c4a5baf55f13c 100644 (file)
@@ -3,6 +3,7 @@ import py_compile
 import re
 import sys
 import shutil
+import stat
 import os
 import tempfile
 
@@ -101,11 +102,16 @@ def copy_to_layout(target, rel_sources):
 
     else:
         for s, rel in rel_sources:
+            dest = target / rel
             try:
-                (target / rel).parent.mkdir(parents=True)
+                dest.parent.mkdir(parents=True)
             except FileExistsError:
                 pass
-            shutil.copy(str(s), str(target / rel))
+            if dest.is_file():
+                dest.chmod(stat.S_IWRITE)
+            shutil.copy(str(s), str(dest))
+            if dest.is_file():
+                dest.chmod(stat.S_IWRITE)
             count += 1
 
     return count