Skip to content

Commit 91cc371

Browse files
JordanYateskartben
authored andcommitted
doc: _extensions: kconfig: allow overwriting Kconfig path
Allow specifying the Kconfig file path in the environment (in practice in the `conf.py` file), to allow the script to correctly find Kconfig roots that aren't in the expected `"modules" / name / "Kconfig"` location. This is required since in the normal build system, the `ZEPHYR_{name_var}_KCONFIG` cmake symbol can be constructed arbitrarily in `modules.cmake`. Signed-off-by: Jordan Yates <[email protected]>
1 parent 86b9ff3 commit 91cc371

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/_extensions/zephyr/kconfig/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,18 @@ def kconfig_load(app: Sphinx) -> tuple[kconfiglib.Kconfig, dict[str, str]]:
156156
if not build_conf:
157157
continue
158158

159+
# Module Kconfig file has already been specified
160+
if f"ZEPHYR_{name_var}_KCONFIG" in os.environ:
161+
continue
162+
159163
if build_conf.get("kconfig"):
160164
kconfig = Path(module.project) / build_conf["kconfig"]
161165
os.environ[f"ZEPHYR_{name_var}_KCONFIG"] = str(kconfig)
162166
elif build_conf.get("kconfig-ext"):
163167
for path in app.config.kconfig_ext_paths:
168+
# Assume that the kconfig file exists at this path.
169+
# Technically the cmake variable can be constructed arbitarily
170+
# by "{ext_path}/modules/modules.cmake"
164171
kconfig = Path(path) / "modules" / name / "Kconfig"
165172
if kconfig.exists():
166173
os.environ[f"ZEPHYR_{name_var}_KCONFIG"] = str(kconfig)

0 commit comments

Comments
 (0)