Skip to content

Commit 011117f

Browse files
committed
Revert "[nrf fromlist] scripts: support soc/boards in Zephyr modules"
This reverts commit 24663df. (temporarily) Signed-off-by: Grzegorz Swiderski <[email protected]>
1 parent a56fee6 commit 011117f

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

scripts/ci/check_compliance.py

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def get_modules(self, modules_file, settings_file):
379379
))
380380
fp_module_file.write(content)
381381

382-
def get_module_setting_root(self, root, settings_file):
382+
def get_kconfig_dts(self, kconfig_dts_file, settings_file):
383383
"""
384384
Generate the Kconfig.dts using dts/bindings as the source.
385385
@@ -388,37 +388,20 @@ def get_module_setting_root(self, root, settings_file):
388388
"""
389389
# Invoke the script directly using the Python executable since this is
390390
# not a module nor a pip-installed Python utility
391-
root_paths = []
391+
zephyr_drv_kconfig_path = os.path.join(ZEPHYR_BASE, "scripts", "dts",
392+
"gen_driver_kconfig_dts.py")
393+
binding_paths = []
394+
binding_paths.append(os.path.join(ZEPHYR_BASE, "dts", "bindings"))
392395

393396
if os.path.exists(settings_file):
394397
with open(settings_file, 'r') as fp_setting_file:
395398
content = fp_setting_file.read()
396399

397400
lines = content.strip().split('\n')
398401
for line in lines:
399-
root = root.upper()
400-
if line.startswith(f'"{root}_ROOT":'):
401-
_, root_path = line.split(":", 1)
402-
root_paths.append(Path(root_path.strip('"')))
403-
return root_paths
404-
405-
def get_kconfig_dts(self, kconfig_dts_file, settings_file):
406-
"""
407-
Generate the Kconfig.dts using dts/bindings as the source.
408-
409-
This is needed to complete Kconfig compliance tests.
410-
411-
"""
412-
# Invoke the script directly using the Python executable since this is
413-
# not a module nor a pip-installed Python utility
414-
zephyr_drv_kconfig_path = os.path.join(ZEPHYR_BASE, "scripts", "dts",
415-
"gen_driver_kconfig_dts.py")
416-
binding_paths = []
417-
binding_paths.append(os.path.join(ZEPHYR_BASE, "dts", "bindings"))
418-
419-
dts_root_paths = self.get_module_setting_root('dts', settings_file)
420-
for p in dts_root_paths:
421-
binding_paths.append(p / "dts" / "bindings")
402+
if line.startswith('"DTS_ROOT":'):
403+
_, dts_root_path = line.split(":", 1)
404+
binding_paths.append(os.path.join(dts_root_path.strip('"'), "dts", "bindings"))
422405

423406
cmd = [sys.executable, zephyr_drv_kconfig_path,
424407
'--kconfig-out', kconfig_dts_file, '--bindings-dirs']
@@ -456,7 +439,7 @@ def get_v1_model_syms(self, kconfig_v1_file, kconfig_v1_syms_file):
456439
fp_kconfig_v1_syms_file.write('\n\t' + kconfiglib.TYPE_TO_STR[s.type])
457440
fp_kconfig_v1_syms_file.write('\n\n')
458441

459-
def get_v2_model(self, kconfig_dir, settings_file):
442+
def get_v2_model(self, kconfig_dir):
460443
"""
461444
Get lists of v2 boards and SoCs and put them in a file that is parsed by
462445
Kconfig
@@ -468,12 +451,8 @@ def get_v2_model(self, kconfig_dir, settings_file):
468451
kconfig_boards_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.boards')
469452
kconfig_defconfig_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.defconfig')
470453

471-
board_roots = self.get_module_setting_root('board', settings_file)
472-
board_roots.insert(0, Path(ZEPHYR_BASE))
473-
soc_roots = self.get_module_setting_root('soc', settings_file)
474-
soc_roots.insert(0, Path(ZEPHYR_BASE))
475-
root_args = argparse.Namespace(**{'board_roots': board_roots,
476-
'soc_roots': soc_roots, 'board': None})
454+
root_args = argparse.Namespace(**{'board_roots': [Path(ZEPHYR_BASE)],
455+
'soc_roots': [Path(ZEPHYR_BASE)], 'board': None})
477456
v2_boards = list_boards.find_v2_boards(root_args)
478457

479458
with open(kconfig_defconfig_file, 'w') as fp:
@@ -579,7 +558,7 @@ def parse_kconfig(self, filename="Kconfig", hwm=None):
579558
os.makedirs(os.path.join(kconfiglib_dir, 'arch'), exist_ok=True)
580559

581560
os.environ["BOARD_DIR"] = kconfiglib_boards_dir
582-
self.get_v2_model(kconfiglib_dir, os.path.join(kconfiglib_dir, "settings_file.txt"))
561+
self.get_v2_model(kconfiglib_dir)
583562

584563
# Tells Kconfiglib to generate warnings for all references to undefined
585564
# symbols within Kconfig files

0 commit comments

Comments
 (0)