From 8ebc553fa0f2d39ca0940682c6c364767c4ce3f9 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 7 Jul 2019 00:18:56 +0000 Subject: [PATCH] build.run: only use os.path on the target OS. Before this commit, BuildPlan.add_file would use os.path.normpath, which would be the wrong thing for cross-builds. --- nmigen/build/run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nmigen/build/run.py b/nmigen/build/run.py index 47de5dd..31d04c8 100644 --- a/nmigen/build/run.py +++ b/nmigen/build/run.py @@ -30,8 +30,6 @@ class BuildPlan: forward slashes (``/``). """ assert isinstance(filename, str) and filename not in self.files - # Just to make sure we don't accidentally overwrite anything. - assert not os.path.normpath(filename).startswith("..") self.files[filename] = content def archive(self, file): @@ -60,6 +58,9 @@ class BuildPlan: os.chdir(root) for filename, content in self.files.items(): + filename = os.path.normpath(filename) + # Just to make sure we don't accidentally overwrite anything outside of build root. + assert not filename.startswith("..") dirname = os.path.dirname(filename) if dirname: os.makedirs(dirname, exist_ok=True) -- 2.30.2