109
109
"_hashlib" : ["openssl" ],
110
110
"_lzma" : ["xz" ],
111
111
"_sqlite3" : ["sqlite" ],
112
- "_ssl" : ["openssl-1.1 " ],
112
+ "_ssl" : ["openssl" ],
113
113
"_tkinter" : ["tcl" , "tk" , "tix" ],
114
114
"_uuid" : ["uuid" ],
115
115
"zlib" : ["zlib" ],
@@ -870,7 +870,7 @@ def hack_props(
870
870
static_replace_in_file (
871
871
openssl_props ,
872
872
b"<_DLLSuffix>-3</_DLLSuffix>" ,
873
- b"<_DLLSuffix>-1_1 %s</_DLLSuffix>" % suffix ,
873
+ b"<_DLLSuffix>-3 %s</_DLLSuffix>" % suffix ,
874
874
)
875
875
except NoSearchStringError :
876
876
static_replace_in_file (
@@ -1565,13 +1565,13 @@ def build_openssl_for_arch(
1565
1565
perl_path ,
1566
1566
arch : str ,
1567
1567
openssl_archive ,
1568
+ openssl_version : str ,
1568
1569
nasm_archive ,
1569
1570
build_root : pathlib .Path ,
1570
1571
profile : str ,
1571
1572
* ,
1572
1573
jom_archive ,
1573
1574
):
1574
- openssl_version = DOWNLOADS ["openssl-1.1" ]["version" ]
1575
1575
nasm_version = DOWNLOADS ["nasm-windows-bin" ]["version" ]
1576
1576
1577
1577
log ("extracting %s to %s" % (openssl_archive , build_root ))
@@ -1661,12 +1661,18 @@ def build_openssl_for_arch(
1661
1661
1662
1662
1663
1663
def build_openssl (
1664
- perl_path : pathlib .Path , arch : str , profile : str , dest_archive : pathlib .Path
1664
+ entry : str ,
1665
+ perl_path : pathlib .Path ,
1666
+ arch : str ,
1667
+ profile : str ,
1668
+ dest_archive : pathlib .Path ,
1665
1669
):
1666
1670
"""Build OpenSSL from sources using the Perl executable specified."""
1667
1671
1672
+ openssl_version = DOWNLOADS [entry ]["version" ]
1673
+
1668
1674
# First ensure the dependencies are in place.
1669
- openssl_archive = download_entry ("openssl-1.1" , BUILD )
1675
+ openssl_archive = download_entry (entry , BUILD )
1670
1676
nasm_archive = download_entry ("nasm-windows-bin" , BUILD )
1671
1677
jom_archive = download_entry ("jom-windows-bin" , BUILD )
1672
1678
@@ -1682,6 +1688,7 @@ def build_openssl(
1682
1688
perl_path ,
1683
1689
"x86" ,
1684
1690
openssl_archive ,
1691
+ openssl_version ,
1685
1692
nasm_archive ,
1686
1693
root_32 ,
1687
1694
profile ,
@@ -1693,6 +1700,7 @@ def build_openssl(
1693
1700
perl_path ,
1694
1701
"amd64" ,
1695
1702
openssl_archive ,
1703
+ openssl_version ,
1696
1704
nasm_archive ,
1697
1705
root_64 ,
1698
1706
profile ,
@@ -1843,6 +1851,7 @@ def collect_python_build_artifacts(
1843
1851
arch : str ,
1844
1852
config : str ,
1845
1853
static : bool ,
1854
+ openssl_entry : str ,
1846
1855
):
1847
1856
"""Collect build artifacts from Python.
1848
1857
@@ -2087,6 +2096,9 @@ def find_additional_dependencies(project: pathlib.Path):
2087
2096
license_public_domain = False
2088
2097
2089
2098
for name in EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY [ext ]:
2099
+ if name == "openssl" :
2100
+ name = openssl_entry
2101
+
2090
2102
download_entry = DOWNLOADS [name ]
2091
2103
2092
2104
# This will raise if no license metadata defined. This is
@@ -2145,6 +2157,7 @@ def build_cpython(
2145
2157
windows_sdk_version : str ,
2146
2158
openssl_archive ,
2147
2159
libffi_archive ,
2160
+ openssl_entry : str ,
2148
2161
):
2149
2162
static = "static" in profile
2150
2163
pgo = "-pgo" in profile
@@ -2439,6 +2452,7 @@ def build_cpython(
2439
2452
build_directory ,
2440
2453
artifact_config ,
2441
2454
static = static ,
2455
+ openssl_entry = openssl_entry ,
2442
2456
)
2443
2457
2444
2458
for ext , init_fn in sorted (builtin_extensions .items ()):
@@ -2648,12 +2662,27 @@ def main():
2648
2662
arch = "amd64"
2649
2663
2650
2664
# TODO need better dependency checking.
2651
- openssl_archive = BUILD / ("openssl-%s-%s.tar" % (target_triple , args .profile ))
2665
+
2666
+ # CPython 3.11+ have native support for OpenSSL 3.x. We anticipate this
2667
+ # will change in a future minor release once OpenSSL 1.1 goes out of support.
2668
+ # But who knows.
2669
+ if args .python in ("cpython-3.8" , "cpython-3.9" , "cpython-3.10" ):
2670
+ openssl_entry = "openssl-1.1"
2671
+ else :
2672
+ openssl_entry = "openssl-3.0"
2673
+
2674
+ openssl_archive = BUILD / (
2675
+ "%s-%s-%s.tar" % (openssl_entry , target_triple , args .profile )
2676
+ )
2652
2677
if not openssl_archive .exists ():
2653
2678
perl_path = fetch_strawberry_perl () / "perl" / "bin" / "perl.exe"
2654
2679
LOG_PREFIX [0 ] = "openssl"
2655
2680
build_openssl (
2656
- perl_path , arch , profile = args .profile , dest_archive = openssl_archive
2681
+ openssl_entry ,
2682
+ perl_path ,
2683
+ arch ,
2684
+ profile = args .profile ,
2685
+ dest_archive = openssl_archive ,
2657
2686
)
2658
2687
2659
2688
libffi_archive = BUILD / ("libffi-%s-%s.tar" % (target_triple , args .profile ))
@@ -2677,6 +2706,7 @@ def main():
2677
2706
windows_sdk_version = args .windows_sdk_version ,
2678
2707
openssl_archive = openssl_archive ,
2679
2708
libffi_archive = libffi_archive ,
2709
+ openssl_entry = openssl_entry ,
2680
2710
)
2681
2711
2682
2712
if "PYBUILD_RELEASE_TAG" in os .environ :
0 commit comments