MCPcopy Create free account
hub / github.com/OpenIPC/firmware / package_of

Function package_of

general/scripts/kconfig_graph.py:59–78  ·  view source on GitHub ↗

Map the Config.in file that defines a symbol to a Buildroot package name. The robust mapping is: take the parent directory of the Config.in file and use its basename. Works for both Buildroot core packages (package/ / Config.in) and OpenIPC external packages (general/package/<

(filename: str | None, *, repo_root: str)

Source from the content-addressed store, hash-verified

57
58
59def package_of(filename: str | None, *, repo_root: str) -> str | None:
60 """
61 Map the Config.in file that defines a symbol to a Buildroot package name.
62
63 The robust mapping is: take the parent directory of the Config.in file and
64 use its basename. Works for both Buildroot core packages (package/<name>/
65 Config.in) and OpenIPC external packages (general/package/<name>/Config.in
66 or general/package/legacy/<name>/Config.in).
67
68 Returns None when the symbol is defined outside a package/ tree (toolchain,
69 fs, system, …).
70 """
71 if not filename:
72 return None
73 parts = Path(filename).parts
74 # We look for the last "package" segment and take the next path element.
75 for i, p in enumerate(parts):
76 if p == "package" and i + 1 < len(parts):
77 return parts[i + 1]
78 return None
79
80
81def setup_kconfig_env(br2_output_dir: str, br_ver: str, repo_root: str) -> str:

Callers 1

build_reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected