[Python-checkins] cpython (3.5): Fixes handling of read-only files when creating zip package.
steve.dower
python-checkins at python.org
Thu Sep 10 04:33:59 CEST 2015
https://hg.python.org/cpython/rev/7c72615070af
changeset: 97839:7c72615070af
branch: 3.5
parent: 97834:df91c1879e56
user: Steve Dower <steve.dower at microsoft.com>
date: Wed Sep 09 19:32:45 2015 -0700
summary:
Fixes handling of read-only files when creating zip package.
files:
Tools/msi/make_zip.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py
--- a/Tools/msi/make_zip.py
+++ b/Tools/msi/make_zip.py
@@ -3,6 +3,7 @@
import re
import sys
import shutil
+import stat
import os
import tempfile
@@ -101,11 +102,16 @@
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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list