Fixes handling of read-only files when creating zip package.
This commit is contained in:
parent
29bf4d403d
commit
ae69de658e
|
@ -3,6 +3,7 @@ import py_compile
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
@ -101,11 +102,16 @@ def copy_to_layout(target, rel_sources):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for s, rel in rel_sources:
|
for s, rel in rel_sources:
|
||||||
|
dest = target / rel
|
||||||
try:
|
try:
|
||||||
(target / rel).parent.mkdir(parents=True)
|
dest.parent.mkdir(parents=True)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
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
|
count += 1
|
||||||
|
|
||||||
return count
|
return count
|
||||||
|
|
Loading…
Reference in New Issue