Before this commit, BuildPlan.add_file would use os.path.normpath,
which would be the wrong thing for cross-builds.
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):
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)