[Python-checkins] cpython (merge 3.5 -> default): Merge with 3.5

steve.dower python-checkins at python.org
Wed Aug 5 20:36:34 CEST 2015


https://hg.python.org/cpython/rev/fe4e2ae492d4
changeset:   97284:fe4e2ae492d4
parent:      97282:95c0710ed0d9
parent:      97283:9575858d45a4
user:        Steve Dower <steve.dower at microsoft.com>
date:        Wed Aug 05 11:35:36 2015 -0700
summary:
  Merge with 3.5

files:
  Tools/msi/make_zip.py |  23 ++++++++++++-----------
  1 files changed, 12 insertions(+), 11 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
@@ -82,18 +82,19 @@
             target.unlink()
 
         with ZipFile(str(target), 'w', ZIP_DEFLATED) as f:
-            for s, rel in rel_sources:
-                if rel.suffix.lower() == '.py':
-                    pyc = Path(tempfile.gettempdir()) / rel.with_suffix('.pyc').name
-                    try:
-                        py_compile.compile(str(s), str(pyc), str(rel), doraise=True, optimize=2)
-                    except py_compile.PyCompileError:
+            with tempfile.TemporaryDirectory() as tmpdir:
+                for s, rel in rel_sources:
+                    if rel.suffix.lower() == '.py':
+                        pyc = Path(tmpdir) / rel.with_suffix('.pyc').name
+                        try:
+                            py_compile.compile(str(s), str(pyc), str(rel), doraise=True, optimize=2)
+                        except py_compile.PyCompileError:
+                            f.write(str(s), str(rel))
+                        else:
+                            f.write(str(pyc), str(rel.with_suffix('.pyc')))
+                    else:
                         f.write(str(s), str(rel))
-                    else:
-                        f.write(str(pyc), str(rel.with_suffix('.pyc')))
-                else:
-                    f.write(str(s), str(rel))
-                count += 1
+                    count += 1
 
     else:
         for s, rel in rel_sources:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list