MCPcopy Index your code
hub / github.com/astral-sh/python-build-standalone / main

Function main

cpython-unix/build.py:958–1299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

956
957
958def 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")

Callers 1

build.pyFile · 0.70

Calls 15

get_target_settingsFunction · 0.90
set_loggerFunction · 0.90
write_dockerfilesFunction · 0.90
get_targetsFunction · 0.90
write_triples_makefilesFunction · 0.90
write_target_settingsFunction · 0.90
write_package_versionsFunction · 0.90
write_cpython_versionFunction · 0.90
build_docker_imageFunction · 0.90
get_imageFunction · 0.90
build_binutilsFunction · 0.85
materialize_clangFunction · 0.85

Tested by

no test coverage detected