8000 Update build.py · adiantek/python-build-standalone@4703094 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4703094

Browse files
authored
Update build.py
1 parent 03f3a37 commit 4703094

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

cpython-windows/build.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,7 @@ def build_openssl_for_arch(
14481448
configure = "VC-WIN64-ARM"
14491449
prefix = "arm64" # TODO check it ???
14501450
else:
1451-
print("invalid architecture: %s" % arch)
1452-
sys.exit(1)
1451+
raise Exception("unhandled architecture: %s" % arch)
14531452

14541453
# The official CPython OpenSSL builds hack ms/uplink.c to change the
14551454
# ``GetModuleHandle(NULL)`` invocation to load things from _ssl.pyd
@@ -1549,7 +1548,7 @@ def build_openssl(
15491548
jom_archive=jom_archive,
15501549
)
15511550
else:
1552-
raise ValueError("unhandled arch: %s" % arch)
1551+
raise Exception("unhandled architecture: %s" % arch)
15531552

15541553
install = td / "out"
15551554

@@ -1660,9 +1659,14 @@ def build_libffi(
16601659
if arch == "x86":
16611660
args.append("-x86")
16621661
artifacts_path = ffi_source_path / "i686-pc-cygwin"
1663-
else:
1662+
elif arch == "arm64":
1663+
args.append("-arm64")
1664+
artifacts_path = ffi_source_path / "aarch64-w64-cygwin"
1665+
elif arch == "amd64":
16641666
args.append("-x64")
16651667
artifacts_path = ffi_source_path / "x86_64-w64-cygwin"
1668+
else:
1669+
raise Exception("unhandled architecture: %s" % arch)
16661670

16671671
subprocess.run(args, env=env, check=True)
16681672

@@ -2024,7 +2028,7 @@ def build_cpython(
20242028
build_platform = "arm64"
20252029
build_directory = "arm64"
20262030
else:
2027-
raise ValueError("unhandled arch: %s" % arch)
2031+
raise Exception("unhandled architecture: %s" % arch)
20282032

20292033
with tempfile.TemporaryDirectory(prefix="python-build-") as td:
20302034
td = pathlib.Path(td)
@@ -2051,7 +2055,7 @@ def build_cpython(
20512055
# We need all the OpenSSL library files in the same directory to appease
20522056
# install rules.
20532057
if not static:
2054-
openssl_arch = {"amd64": "amd64", "x86": "win32"}[arch]
2058+
openssl_arch = {"amd64": "amd64", "x86": "win32"}[arch] # TODO
20552059
openssl_root = td / "openssl" / openssl_arch
20562060
openssl_bin_path = openssl_root / "bin"
20572061
openssl_lib_path = openssl_root / "lib"
@@ -2459,9 +2463,11 @@ def main():
24592463
elif os.environ.get("Platform") == "arm64":
24602464
target_triple = "aarch64-pc-windows-msvc"
24612465
arch = "arm64"
2462-
else:
2466+
elif os.environ.get("Platform") == "x64":
24632467
target_triple = "x86_64-pc-windows-msvc"
24642468
arch = "amd64"
2469+
else:
2470+
raise Exception("unhandled architecture: %s" % os.environ.get("Platform"))
24652471

24662472
# TODO need better dependency checking.
24672473
openssl_archive = BUILD / ("openssl-%s-%s.tar" % (target_triple, args.profile))

0 commit comments

Comments
 (0)
0