MCPcopy Index your code
hub / github.com/python/cpython / detect_extension_modules

Function detect_extension_modules

Platforms/emscripten/wasm_assets.py:136–163  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

134
135
136def detect_extension_modules(args: argparse.Namespace) -> dict[str, bool]:
137 modules = {}
138
139 # disabled by Modules/Setup.local ?
140 with open(args.buildroot / "Makefile") as f:
141 for line in f:
142 if line.startswith("MODDISABLED_NAMES="):
143 disabled = line.split("=", 1)[1].strip().split()
144 for modname in disabled:
145 modules[modname] = False
146 break
147
148 # disabled by configure?
149 with open(args.sysconfig_data) as f:
150 data = f.read()
151 loc: dict[str, dict[str, str]] = {}
152 exec(data, globals(), loc)
153
154 for key, value in loc["build_time_vars"].items():
155 if not key.startswith("MODULE_") or not key.endswith("_STATE"):
156 continue
157 if value not in {"yes", "disabled", "missing", "n/a"}:
158 raise ValueError(f"Unsupported value '{value}' for {key}")
159
160 modname = key[7:-6].lower()
161 if modname not in modules:
162 modules[modname] = value == "yes"
163 return modules
164
165
166def path(val: str) -> pathlib.Path:

Callers 1

mainFunction · 0.85

Calls 8

openFunction · 0.50
startswithMethod · 0.45
splitMethod · 0.45
stripMethod · 0.45
readMethod · 0.45
itemsMethod · 0.45
endswithMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…