Skip to content

Commit 176225d

Browse files
mbolivar-nordiccfriedt
authored andcommitted
dtlib: add force DT kwarg
Modeled after dtc's --force option, the idea is this will try harder and harder over time to produce an object despite malformed input. Signed-off-by: Martí Bolívar <[email protected]>
1 parent d0b9c03 commit 176225d

File tree

1 file changed

+7
-1
lines changed
  • scripts/dts/python-devicetree/src/devicetree

1 file changed

+7
-1
lines changed

scripts/dts/python-devicetree/src/devicetree/dtlib.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ class DT:
709709
# Public interface
710710
#
711711

712-
def __init__(self, filename: str, include_path: Iterable[str] = ()):
712+
def __init__(self, filename: str, include_path: Iterable[str] = (),
713+
force: bool = False):
713714
"""
714715
Parses a DTS file to create a DT instance. Raises OSError if 'filename'
715716
can't be opened, and DTError for any parse errors.
@@ -721,9 +722,14 @@ def __init__(self, filename: str, include_path: Iterable[str] = ()):
721722
An iterable (e.g. list or tuple) containing paths to search for
722723
/include/d and /incbin/'d files. By default, files are only looked up
723724
relative to the .dts file that contains the /include/ or /incbin/.
725+
726+
force:
727+
Try not to raise DTError even if the input tree has errors.
728+
For experimental use; results not guaranteed.
724729
"""
725730
self.filename = filename
726731
self._include_path = list(include_path)
732+
self._force = force
727733

728734
with open(filename, encoding="utf-8") as f:
729735
self._file_contents = f.read()

0 commit comments

Comments
 (0)