()
| 867 | |
| 868 | |
| 869 | def parse_args(): |
| 870 | parser = argparse.ArgumentParser() |
| 871 | subcommands = parser.add_subparsers(dest="subcommand", required=True) |
| 872 | |
| 873 | def add_parser(*args, **kwargs): |
| 874 | parser = subcommands.add_parser(*args, **kwargs) |
| 875 | parser.add_argument( |
| 876 | "-v", "--verbose", action="count", default=0, |
| 877 | help="Show verbose output. Use twice to be even more verbose.") |
| 878 | return parser |
| 879 | |
| 880 | # Subcommands |
| 881 | build = add_parser( |
| 882 | "build", |
| 883 | help="Run configure and make for the selected target" |
| 884 | ) |
| 885 | configure_build = add_parser( |
| 886 | "configure-build", help="Run `configure` for the build Python") |
| 887 | make_build = add_parser( |
| 888 | "make-build", help="Run `make` for the build Python") |
| 889 | configure_host = add_parser( |
| 890 | "configure-host", help="Run `configure` for Android") |
| 891 | make_host = add_parser( |
| 892 | "make-host", help="Run `make` for Android") |
| 893 | |
| 894 | clean = add_parser( |
| 895 | "clean", |
| 896 | help="Delete build directories for the selected target" |
| 897 | ) |
| 898 | |
| 899 | add_parser("build-testbed", help="Build the testbed app") |
| 900 | test = add_parser("test", help="Run the testbed app") |
| 901 | package = add_parser("package", help="Make a release package") |
| 902 | ci = add_parser("ci", help="Run build, package and test") |
| 903 | env = add_parser("env", help="Print environment variables") |
| 904 | |
| 905 | # Common arguments |
| 906 | # --cross-build-dir argument |
| 907 | for cmd in [ |
| 908 | clean, |
| 909 | configure_build, |
| 910 | make_build, |
| 911 | configure_host, |
| 912 | make_host, |
| 913 | build, |
| 914 | package, |
| 915 | test, |
| 916 | ci, |
| 917 | ]: |
| 918 | cmd.add_argument( |
| 919 | "--cross-build-dir", |
| 920 | action="store", |
| 921 | default=os.environ.get("CROSS_BUILD_DIR"), |
| 922 | dest="cross_build_dir", |
| 923 | type=Path, |
| 924 | help=( |
| 925 | "Path to the cross-build directory " |
| 926 | f"(default: {CROSS_BUILD_DIR}). Can also be set " |
no test coverage detected
searching dependent graphs…