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.
This commit is contained in:
parent
ba64eb2037
commit
744154ebb5
|
@ -30,8 +30,6 @@ class BuildPlan:
|
||||||
forward slashes (``/``).
|
forward slashes (``/``).
|
||||||
"""
|
"""
|
||||||
assert isinstance(filename, str) and filename not in self.files
|
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
|
self.files[filename] = content
|
||||||
|
|
||||||
def archive(self, file):
|
def archive(self, file):
|
||||||
|
@ -60,6 +58,9 @@ class BuildPlan:
|
||||||
os.chdir(root)
|
os.chdir(root)
|
||||||
|
|
||||||
for filename, content in self.files.items():
|
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)
|
dirname = os.path.dirname(filename)
|
||||||
if dirname:
|
if dirname:
|
||||||
os.makedirs(dirname, exist_ok=True)
|
os.makedirs(dirname, exist_ok=True)
|
||||||
|
|
Loading…
Reference in a new issue