| 396 | |
| 397 | |
| 398 | def do_debug_build(): |
| 399 | # Note: The shenanigans in this function with ninja are to avoid leaving |
| 400 | # someone stuck with a debug build which doen't match when that's not |
| 401 | # something they're used to encountering. |
| 402 | |
| 403 | # Save the old ninja file to restore after making the debug build. |
| 404 | ninja_file = REPO_ROOT / "build.ninja" |
| 405 | ninja_save = ninja_file.with_suffix(".bak") |
| 406 | had_ninja_file = False |
| 407 | if ninja_file.exists(): |
| 408 | had_ninja_file = True |
| 409 | if ninja_save.exists(): |
| 410 | os.remove(ninja_save) |
| 411 | os.rename(ninja_file, ninja_save) |
| 412 | |
| 413 | import subprocess |
| 414 | print("Creating a debug build to extract info from. This will take a moment.") |
| 415 | subprocess.run(["python", "configure.py", "--debug"], cwd=REPO_ROOT, check=True, capture_output=True) |
| 416 | subprocess.run(["ninja"], cwd=REPO_ROOT, check=False, capture_output=True) |
| 417 | |
| 418 | # Restore the old ninja file if they had one |
| 419 | os.remove(ninja_file) |
| 420 | if had_ninja_file: |
| 421 | os.rename(ninja_save, ninja_file) |
| 422 | |
| 423 | |
| 424 | def extract_info() -> ExtractedInfo: |