build.run: fix product extraction to work on Windows.
Before this commit, it would fail with a "Permission denied" error.
This commit is contained in:
parent
63c4123f6e
commit
3adce21ce3
|
@ -68,9 +68,14 @@ class BuildProducts:
|
||||||
files = []
|
files = []
|
||||||
try:
|
try:
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
file = tempfile.NamedTemporaryFile(prefix="nmigen_", suffix="_" + filename)
|
# On Windows, a named temporary file (as created by Python) is not accessible to
|
||||||
|
# others if it's still open within the Python process, so we close it and delete
|
||||||
|
# it manually.
|
||||||
|
file = tempfile.NamedTemporaryFile(prefix="nmigen_", suffix="_" + filename,
|
||||||
|
delete=False)
|
||||||
files.append(file)
|
files.append(file)
|
||||||
file.write(self.get(filename))
|
file.write(self.get(filename))
|
||||||
|
file.close()
|
||||||
|
|
||||||
if len(files) == 0:
|
if len(files) == 0:
|
||||||
return (yield)
|
return (yield)
|
||||||
|
@ -80,4 +85,4 @@ class BuildProducts:
|
||||||
return (yield [file.name for file in files])
|
return (yield [file.name for file in files])
|
||||||
finally:
|
finally:
|
||||||
for file in files:
|
for file in files:
|
||||||
file.close()
|
os.unlink(file.name)
|
||||||
|
|
Loading…
Reference in a new issue