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

Function main

cpython-windows/build.py:1938–2061  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1936
1937
1938def main() -> None:
1939 BUILD.mkdir(exist_ok=True)
1940
1941 parser = argparse.ArgumentParser()
1942 parser.add_argument(
1943 "--vs",
1944 choices={"2019", "2022", "2026"},
1945 default="2022",
1946 help="Visual Studio version to use",
1947 )
1948 parser.add_argument(
1949 "--python",
1950 choices={
1951 "cpython-3.10",
1952 "cpython-3.11",
1953 "cpython-3.12",
1954 "cpython-3.13",
1955 "cpython-3.14",
1956 "cpython-3.15",
1957 },
1958 default="cpython-3.11",
1959 help="Python distribution to build",
1960 )
1961 optimizations = {"noopt", "pgo"}
1962 parser.add_argument(
1963 "--options",
1964 choices=optimizations.union({f"freethreaded+{o}" for o in optimizations}),
1965 default="noopt",
1966 help="Build options to apply when compiling Python",
1967 )
1968 parser.add_argument(
1969 "--sh", required=True, help="Path to sh.exe in a cygwin or mingw installation"
1970 )
1971 parser.add_argument(
1972 "--windows-sdk-version",
1973 default="10.0.26100.0",
1974 help="Windows SDK version to build with",
1975 )
1976
1977 args = parser.parse_args()
1978 build_options = args.options
1979
1980 log_path = BUILD / "build.log"
1981
1982 with log_path.open("wb") as log_fh:
1983 LOG_FH[0] = log_fh
1984
1985 if os.environ.get("Platform") == "x86":
1986 target_triple = "i686-pc-windows-msvc"
1987 arch = "x86"
1988 elif os.environ.get("Platform") == "arm64":
1989 target_triple = "aarch64-pc-windows-msvc"
1990 arch = "arm64"
1991 elif os.environ.get("Platform") == "x64":
1992 target_triple = "x86_64-pc-windows-msvc"
1993 arch = "amd64"
1994 else:
1995 raise Exception("unhandled architecture: %s" % os.environ.get("Platform"))

Callers 1

build.pyFile · 0.70

Calls 6

release_tag_from_gitFunction · 0.90
compress_python_archiveFunction · 0.90
fetch_strawberry_perlFunction · 0.85
build_opensslFunction · 0.85
build_libffiFunction · 0.85
build_cpythonFunction · 0.70

Tested by

no test coverage detected