(args: argparse.Namespace)
| 134 | |
| 135 | |
| 136 | def 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 | |
| 166 | def path(val: str) -> pathlib.Path: |
no test coverage detected
searching dependent graphs…