build.run: fix BuildProducts.extract to work with subdirectories.
authorwhitequark <whitequark@whitequark.org>
Sun, 12 Apr 2020 04:56:15 +0000 (04:56 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 13:25:19 +0000 (13:25 +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()