Skip to content

Commit aa01249

Browse files
committed
Avoid accessing the _mtree field
1 parent 1403146 commit aa01249

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pycheribuild/mtree.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,16 @@ def add_from_mtree(self, mtree_file: "MtreeFile", path: "Union[PurePath, str]",
406406
assert not path.startswith("/")
407407
path = path.rstrip("/") # remove trailing slashes
408408
mtree_path = self._ensure_mtree_path_fmt(path)
409-
if mtree_path in self._mtree:
409+
if self.get(mtree_path) is not None:
410410
return
411-
if mtree_path not in mtree_file._mtree:
411+
subtree = mtree_file.get(mtree_path)
412+
if subtree is None:
412413
fatal_error("Could not find " + str(mtree_path) + " in source mtree", pretend=True)
413414
return
414415
parent = mtree_path.parent
415416
if parent != mtree_path:
416417
self.add_from_mtree(mtree_file, parent, print_status=print_status)
417-
attribs = mtree_file._mtree[mtree_path].attributes
418+
attribs = subtree.attributes
418419
entry = MtreeEntry(mtree_path, attribs)
419420
if print_status:
420421
if "link" in attribs:

0 commit comments

Comments
 (0)