Skip to content

Commit cf95d1f

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 a4a2dda commit cf95d1f

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
@@ -345,15 +345,23 @@ def check_board_file(self, file, vendor_prefixes):
345345

346346
def run(self):
347347
path = resolve_path_hint(self.path_hint)
348+
module_yml = path / "zephyr" / "module.yml"
348349

349350
vendor_prefixes = {"others"}
350351
# add vendor prefixes from the main zephyr repo
351352
vendor_prefixes |= get_vendor_prefixes(ZEPHYR_BASE / "dts" / "bindings" / "vendor-prefixes.txt", self.error)
352-
353353
# add vendor prefixes from the current repo
354-
dts_roots = get_module_setting_root('dts', path / "zephyr" / "module.yml")
355-
for dts_root in dts_roots:
356-
vendor_prefix_file = dts_root / "dts" / "bindings" / "vendor-prefixes.txt"
354+
dts_root = None
355+
if module_yml.is_file():
356+
with module_yml.open('r', encoding='utf-8') as f:
357+
meta = yaml.load(f.read(), Loader=SafeLoader)
358+
section = meta.get('build', dict())
359+
build_settings = section.get('settings', None)
360+
if build_settings:
361+
dts_root = build_settings.get('dts_root', None)
362+
363+
if dts_root:
364+
vendor_prefix_file = Path(dts_root) / "dts" / "bindings" / "vendor-prefixes.txt"
357365
if vendor_prefix_file.exists():
358366
vendor_prefixes |= get_vendor_prefixes(vendor_prefix_file, self.error)
359367

0 commit comments

Comments
 (0)