Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 988433f

Browse files
committed
Fixes handling of read-only files when creating zip package.
2 parents 3e2c8d8 + ae69de6 commit 988433f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Tools/msi/make_zip.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import sys
55
import shutil
6+
import stat
67
import os
78
import tempfile
89

@@ -101,11 +102,16 @@ def copy_to_layout(target, rel_sources):
101102

102103
else:
103104
for s, rel in rel_sources:
105+
dest = target / rel
104106
try:
105-
(target / rel).parent.mkdir(parents=True)
107+
dest.parent.mkdir(parents=True)
106108
except FileExistsError:
107109
pass
108-
shutil.copy(str(s), str(target / rel))
110+
if dest.is_file():
111+
dest.chmod(stat.S_IWRITE)
112+
shutil.copy(str(s), str(dest))
113+
if dest.is_file():
114+
dest.chmod(stat.S_IWRITE)
109115
count += 1
110116

111117
return count

0 commit comments

Comments
 (0)