From: whitequark Date: Sun, 7 Jul 2019 00:18:56 +0000 (+0000) Subject: build.run: only use os.path on the target OS. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ebc553fa0f2d39ca0940682c6c364767c4ce3f9;p=nmigen.git 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. --- 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)