()
| 1058 | |
| 1059 | |
| 1060 | def main() -> None: |
| 1061 | # Handle SIGTERM the same way as SIGINT. This ensures that if we're |
| 1062 | # terminated by the buildbot worker, we'll make an attempt to clean up our |
| 1063 | # subprocesses. |
| 1064 | def signal_handler(*args): |
| 1065 | os.kill(os.getpid(), signal.SIGINT) |
| 1066 | |
| 1067 | signal.signal(signal.SIGTERM, signal_handler) |
| 1068 | |
| 1069 | # Process command line arguments |
| 1070 | context = parse_args() |
| 1071 | |
| 1072 | # Set the CROSS_BUILD_DIR if an argument was provided |
| 1073 | if context.cross_build_dir: |
| 1074 | global CROSS_BUILD_DIR |
| 1075 | CROSS_BUILD_DIR = context.cross_build_dir.resolve() |
| 1076 | |
| 1077 | dispatch: dict[str, Callable] = { |
| 1078 | "clean": clean, |
| 1079 | "configure-build": configure_build_python, |
| 1080 | "make-build": make_build_python, |
| 1081 | "configure-host": configure_host_python, |
| 1082 | "make-host": make_host_python, |
| 1083 | "package": package, |
| 1084 | "build": build, |
| 1085 | "test": test, |
| 1086 | "ci": ci, |
| 1087 | } |
| 1088 | |
| 1089 | try: |
| 1090 | dispatch[context.subcommand](context) |
| 1091 | except CalledProcessError as e: |
| 1092 | print() |
| 1093 | print_called_process_error(e) |
| 1094 | sys.exit(1) |
| 1095 | except RuntimeError as e: |
| 1096 | print() |
| 1097 | print(e) |
| 1098 | sys.exit(2) |
| 1099 | |
| 1100 | |
| 1101 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…