Commit 315b748c authored by Steve Dower's avatar Steve Dower

Fixes make_zip.py to create temporary .pyc files in a separate directory. This...

Fixes make_zip.py to create temporary .pyc files in a separate directory. This avoids polluting tests that run code from TEMP.
parent 6703d032
......@@ -82,9 +82,10 @@ def copy_to_layout(target, rel_sources):
target.unlink()
with ZipFile(str(target), 'w', ZIP_DEFLATED) as f:
with tempfile.TemporaryDirectory() as tmpdir:
for s, rel in rel_sources:
if rel.suffix.lower() == '.py':
pyc = Path(tempfile.gettempdir()) / rel.with_suffix('.pyc').name
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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment