dts: edtlib: Add an EDT.dts_source attribute that holds the source code

EDT.dts_source is the source code of the loaded .dts file, after merging
nodes.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson 2020-01-29 06:25:20 +01:00 committed by Kumar Gala
commit a758af4988

View file

@ -118,6 +118,10 @@ class EDT:
dts_path:
The .dts path passed to __init__()
dts_source:
The final DTS source code of the loaded devicetree after merging nodes
and processing /delete-node/ and /delete-property/, as a string
bindings_dirs:
The bindings directory paths passed to __init__()
"""
@ -178,6 +182,10 @@ class EDT:
# to_path() checks that the node exists
return self._node2enode[chosen.props[name].to_path()]
@property
def dts_source(self):
return f"{self._dt}"
def __repr__(self):
return "<EDT for '{}', binding directories '{}'>".format(
self.dts_path, self.bindings_dirs)