Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools/build/stable_abi.py: Improve ergonomics #105355

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ check-abidump: all

.PHONY: regen-limited-abi
regen-limited-abi: all
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --generate-all $(srcdir)/Misc/stable_abi.toml
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --generate-all

############################################################################
# Regenerate Unicode Data
Expand Down Expand Up @@ -3136,7 +3136,7 @@ patchcheck: all

.PHONY: check-limited-abi
check-limited-abi: all
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --all $(srcdir)/Misc/stable_abi.toml
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --all

.PHONY: update-config
update-config:
Expand Down
15 changes: 10 additions & 5 deletions Tools/build/stable_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import csv

SCRIPT_NAME = 'Tools/build/stable_abi.py'
DEFAULT_MANIFEST_PATH = (
Path(__file__).parent / '../../Misc/stable_abi.toml').resolve()
AlexWaygood marked this conversation as resolved.
Show resolved Hide resolved
MISSING = object()

EXCLUDED_HEADERS = {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand Down
Loading