()
| 624 | return True |
| 625 | |
| 626 | def main(): |
| 627 | parser = argparse.ArgumentParser( |
| 628 | description=__doc__, |
| 629 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 630 | ) |
| 631 | parser.add_argument( |
| 632 | "file", type=Path, metavar='FILE', |
| 633 | help="file with the stable abi manifest", |
| 634 | ) |
| 635 | parser.add_argument( |
| 636 | "--generate", action='store_true', |
| 637 | help="generate file(s), rather than just checking them", |
| 638 | ) |
| 639 | parser.add_argument( |
| 640 | "--generate-all", action='store_true', |
| 641 | help="as --generate, but generate all file(s) using default filenames." |
| 642 | + " (unlike --all, does not run any extra checks)", |
| 643 | ) |
| 644 | parser.add_argument( |
| 645 | "-a", "--all", action='store_true', |
| 646 | help="run all available checks using default filenames", |
| 647 | ) |
| 648 | parser.add_argument( |
| 649 | "-l", "--list", action='store_true', |
| 650 | help="list available generators and their default filenames; then exit", |
| 651 | ) |
| 652 | parser.add_argument( |
| 653 | "--dump", action='store_true', |
| 654 | help="dump the manifest contents (used for debugging the parser)", |
| 655 | ) |
| 656 | |
| 657 | actions_group = parser.add_argument_group('actions') |
| 658 | for gen in generators: |
| 659 | actions_group.add_argument( |
| 660 | gen.arg_name, dest=gen.var_name, |
| 661 | type=str, nargs="?", default=MISSING, |
| 662 | metavar='FILENAME', |
| 663 | help=gen.__doc__, |
| 664 | ) |
| 665 | actions_group.add_argument( |
| 666 | '--unixy-check', action='store_true', |
| 667 | help=do_unixy_check.__doc__, |
| 668 | ) |
| 669 | args = parser.parse_args() |
| 670 | |
| 671 | base_path = args.file.parent.parent |
| 672 | |
| 673 | if args.list: |
| 674 | for gen in generators: |
| 675 | print(f'{gen.arg_name}: {base_path / gen.default_path}') |
| 676 | sys.exit(0) |
| 677 | |
| 678 | run_all_generators = args.generate_all |
| 679 | |
| 680 | if args.generate_all: |
| 681 | args.generate = True |
| 682 | |
| 683 | if args.all: |
no test coverage detected