tooling: extract main(argv) and add dest path and subprocess error guards in fetch_addrlib with CLI suite #2592
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2600"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T22:42:29Z.
Summary
tools/fetch_addrlib.py:main(argv=None) -> int(raise SystemExit(main())under__main__) so the CLI entry point accepts explicitargvand returns an integer status cleanly.--destis not an existing non-directory file (dest.exists() and not dest.is_dir()), check emptiness deterministically viasorted(dest.iterdir()), and catch(OSError, ValueError, subprocess.SubprocessError)viaparser.exit(1, f"fetch_addrlib: {exc}\n")while preserving non-empty, dirty-checkout, remote-mismatch, commit-mismatch, and missing-header refusals with zero raw tracebacks.tests/fetch_addrlib_cli_check.pyand registertooling_fetch_addrlib_cli_check(TIMEOUT 60) inCMakeLists.txt.Verification
python -B tests/fetch_addrlib_cli_check.py -v->Ran 6 tests in 0.618s(OK, exit 0)OSError/ValueError/SubprocessErrorhandlers, exit code, stderr prefix,argvforwarding,main()return type, and__main__exit propagation) ->15/15 KILLEDpython -B tests/form_coverage_check.py->form coverage checks passed(exit 0)python -B tests/docs_links_check.py->Self-test passed. Checked 19 Markdown files and 499 links.(exit 0)python -B tests/bidi_controls_check.py->Self-test passed. Checked 1832 tracked source, script and build/CI files: no bidirectional controls.(exit 0)AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:46:32Z.
Review: COMMENTED
Review of head
550359d9against origin/main. No blocking findings.What I checked
main(argv=None) -> intandraise SystemExit(main()): correct, success returns 0.--destpointing at an existing file is refused with exit 1 and a one-line message. OSError, ValueError and SubprocessError now give exit 1 with no traceback. The sys.exit refusals (non-empty dest, dirty checkout, wrong remote, commit mismatch, missing header) still behave as before.tests/fetch_addrlib_cli_check.pyis offline (mocked git) and is registered in CMake next to the other INTAKE_PYTHON tests. No sibling callers offetch_addrlib.mainexist.Commands run (Linux)
python3 -B tests/fetch_addrlib_cli_check.py-> Ran 6 tests, OKpython3 tests/docs_links_check.py-> 19 files, 499 links, okpython3 tests/bidi_controls_check.py-> no bidirectional controlsgit diff --check origin/main...HEAD-> cleanWindows dev+release verification follows in a separate receipt comment.
AI-assisted; commands listed were executed locally.