diff options
author | Petr Viktorin <encukou@gmail.com> | 2024-09-17 12:32:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-17 12:32:04 (GMT) |
commit | 4d0971934145698bc57d287bb9fe9112bd325899 (patch) | |
tree | 441f0798699302b65839c129144e93061d2b4c03 /Tools/build/stable_abi.py | |
parent | 28aea5d07d163105b42acd81c1651397ef95ea57 (diff) | |
download | cpython-4d0971934145698bc57d287bb9fe9112bd325899.zip cpython-4d0971934145698bc57d287bb9fe9112bd325899.tar.gz cpython-4d0971934145698bc57d287bb9fe9112bd325899.tar.bz2 |
Tools/build/stable_abi.py: Improve ergonomics (GH-105355)
* Tools/build/stable_abi.py: Improve ergonomics
- Make the manifest file argument optional
- Output resolved paths with --list (getting rid of `../../`)
- Mention --all or --generate-all if no actions are specified
* Don't hardcode Misc/stable_abi.toml in Makefile, rely on the default
Diffstat (limited to 'Tools/build/stable_abi.py')
-rw-r--r-- | Tools/build/stable_abi.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Tools/build/stable_abi.py b/Tools/build/stable_abi.py index f7fccb6..2874c43 100644 --- a/Tools/build/stable_abi.py +++ b/Tools/build/stable_abi.py @@ -25,6 +25,8 @@ import re import csv SCRIPT_NAME = 'Tools/build/stable_abi.py' +DEFAULT_MANIFEST_PATH = ( + Path(__file__).parent / '../../Misc/stable_abi.toml').resolve() MISSING = object() EXCLUDED_HEADERS = { @@ -641,8 +643,9 @@ def main(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument( - "file", type=Path, metavar='FILE', - help="file with the stable abi manifest", + "file", type=Path, metavar='FILE', nargs='?', + default=DEFAULT_MANIFEST_PATH, + help=f"file with the stable abi manifest (default: {DEFAULT_MANIFEST_PATH})", ) parser.add_argument( "--generate", action='store_true', @@ -684,7 +687,7 @@ def main(): if args.list: for gen in generators: - print(f'{gen.arg_name}: {base_path / gen.default_path}') + print(f'{gen.arg_name}: {(base_path / gen.default_path).resolve()}') sys.exit(0) run_all_generators = args.generate_all @@ -735,8 +738,10 @@ def main(): if not results: if args.generate: - parser.error('No file specified. Use --help for usage.') - parser.error('No check specified. Use --help for usage.') + parser.error('No file specified. Use --generate-all to regenerate ' + + 'all files, or --help for usage.') + parser.error('No check specified. Use --all to check all files, ' + + 'or --help for usage.') failed_results = [name for name, result in results.items() if not result] |