Skip to content

Commit 4a8d43b

Browse files
committed
[nrf fromlist] scripts: parse module.yml for dts bindings
Change BoardYml compliance check from using get_module_setting_root() to load and parse module.yml directly. get_module_setting_root cannot be used directly with module.yml. Instead adjust the code so that the module.yml file is loaded locally and the dts_root setting is extracted from the dictionary. Upstream PR #: 94397 Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 8d7b9c9 commit 4a8d43b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/ci/check_compliance.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,23 @@ def check_board_file(self, file, vendor_prefixes):
315315

316316
def run(self):
317317
path = resolve_path_hint(self.path_hint)
318+
module_yml = path / "zephyr" / "module.yml"
318319

319320
vendor_prefixes = {"others"}
320321
# add vendor prefixes from the main zephyr repo
321322
vendor_prefixes |= get_vendor_prefixes(ZEPHYR_BASE / "dts" / "bindings" / "vendor-prefixes.txt", self.error)
322-
323323
# add vendor prefixes from the current repo
324-
dts_roots = get_module_setting_root('dts', path / "zephyr" / "module.yml")
325-
for dts_root in dts_roots:
326-
vendor_prefix_file = dts_root / "dts" / "bindings" / "vendor-prefixes.txt"
324+
dts_root = None
325+
if module_yml.is_file():
326+
with module_yml.open('r', encoding='utf-8') as f:
327+
meta = yaml.load(f.read(), Loader=SafeLoader)
328+
section = meta.get('build', dict())
329+
build_settings = section.get('settings', None)
330+
if build_settings:
331+
dts_root = build_settings.get('dts_root', None)
332+
333+
if dts_root:
334+
vendor_prefix_file = Path(dts_root) / "dts" / "bindings" / "vendor-prefixes.txt"
327335
if vendor_prefix_file.exists():
328336
vendor_prefixes |= get_vendor_prefixes(vendor_prefix_file, self.error)
329337

0 commit comments

Comments
 (0)