build.run: fix BuildProducts.extract to work with subdirectories.
authorwhitequark <whitequark@whitequark.org>
Sun, 12 Apr 2020 04:56:15 +0000 (04:56 +0000)
committerwhitequark <whitequark@whitequark.org>
Sun, 12 Apr 2020 04:56:15 +0000 (04:56 +0000)
Fixes #353.

nmigen/build/run.py

index a32f38e76b8f67334ed5a3e0837396e6bf3c5b83..93aa4df06dee4e9b04e07867973618078ef28115 100644 (file)
@@ -136,8 +136,9 @@ class BuildProducts(metaclass=ABCMeta):
                 # 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)
+                file = tempfile.NamedTemporaryFile(
+                    prefix="nmigen_", suffix="_" + os.path.basename(filename),
+                    delete=False)
                 files.append(file)
                 file.write(self.get(filename))
                 file.close()