()
| 956 | |
| 957 | |
| 958 | def main(): |
| 959 | BUILD.mkdir(exist_ok=True) |
| 960 | DOWNLOADS_PATH.mkdir(exist_ok=True) |
| 961 | (BUILD / "logs").mkdir(exist_ok=True) |
| 962 | |
| 963 | if os.environ.get("PYBUILD_NO_DOCKER"): |
| 964 | client = None |
| 965 | else: |
| 966 | try: |
| 967 | client = docker.from_env(timeout=600) |
| 968 | client.ping() |
| 969 | except Exception as e: |
| 970 | print("unable to connect to Docker: %s" % e, file=sys.stderr) |
| 971 | return 1 |
| 972 | |
| 973 | # Note these arguments must be synced with `build-main.py` |
| 974 | parser = argparse.ArgumentParser() |
| 975 | parser.add_argument( |
| 976 | "--host-platform", required=True, help="Platform we are building from" |
| 977 | ) |
| 978 | parser.add_argument( |
| 979 | "--target-triple", |
| 980 | required=True, |
| 981 | help="Host triple that we are building Python for", |
| 982 | ) |
| 983 | |
| 984 | # Construct possible options |
| 985 | options = set() |
| 986 | options.update({"debug", "noopt", "pgo", "lto", "pgo+lto"}) |
| 987 | options.update({f"freethreaded+{option}" for option in options}) |
| 988 | options.update({f"{option}+static" for option in options}) |
| 989 | parser.add_argument( |
| 990 | "--options", |
| 991 | choices=options, |
| 992 | default="noopt", |
| 993 | help="Build options to apply when compiling Python", |
| 994 | ) |
| 995 | |
| 996 | parser.add_argument( |
| 997 | "--toolchain", |
| 998 | action="store_true", |
| 999 | help="Indicates we are building a toolchain artifact", |
| 1000 | ) |
| 1001 | parser.add_argument( |
| 1002 | "--dest-archive", required=True, help="Path to archive that we are producing" |
| 1003 | ) |
| 1004 | parser.add_argument("--docker-image", help="Docker image to use for building") |
| 1005 | parser.add_argument( |
| 1006 | "--python-source", |
| 1007 | default=None, |
| 1008 | help="A custom path to CPython source files to use", |
| 1009 | ) |
| 1010 | parser.add_argument( |
| 1011 | "--python-host-version", |
| 1012 | default=None, |
| 1013 | help="Python X.Y version for host Python installation", |
| 1014 | ) |
| 1015 | parser.add_argument("action") |
no test coverage detected