66
66
"shared_depends_win32" : ["libcrypto-1_1" , "libssl-1_1" ],
67
67
"static_depends_no_project" : ["libcrypto_static" , "libssl_static" ],
68
68
},
69
+ "_tkinter" : {"ignore_static" : True , "shared_depends" : ["tcl86t" , "tk86t" ],},
69
70
"_queue" : {},
70
71
"pyexpat" : {},
71
72
"select" : {},
85
86
86
87
# Used to annotate licenses.
87
88
EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY = {
88
- "_bz2" : "bzip2" ,
89
- "_ctypes" : "libffi" ,
90
- "_hashlib" : "openssl" ,
91
- "_lzma" : "xz" ,
92
- "_sqlite3" : "sqlite" ,
93
- "_ssl" : "openssl" ,
94
- "_uuid" : "uuid" ,
95
- "zlib" : "zlib" ,
89
+ "_bz2" : ["bzip2" ],
90
+ "_ctypes" : ["libffi" ],
91
+ "_hashlib" : ["openssl" ],
92
+ "_lzma" : ["xz" ],
93
+ "_sqlite3" : ["sqlite" ],
94
+ "_ssl" : ["openssl" ],
95
+ "_tkinter" : ["tcl" , "tk" , "tix" ],
96
+ "_uuid" : ["uuid" ],
97
+ "zlib" : ["zlib" ],
96
98
}
97
99
98
100
@@ -780,6 +782,10 @@ def hack_project_files(
780
782
781
783
if static :
782
784
for extension , entry in sorted (CONVERT_TO_BUILTIN_EXTENSIONS .items ()):
785
+ if entry .get ("ignore_static" ):
786
+ log ("ignoring extension %s in static builds" % extension )
787
+ continue
788
+
783
789
init_fn = entry .get ("init" , "PyInit_%s" % extension )
784
790
785
791
add_to_config_c (cpython_source_path , extension , init_fn )
@@ -1051,7 +1057,11 @@ def hack_source_files(source_path: pathlib.Path, static: bool):
1051
1057
1052
1058
1053
1059
def run_msbuild (
1054
- msbuild : pathlib .Path , pcbuild_path : pathlib .Path , configuration : str , platform : str
1060
+ msbuild : pathlib .Path ,
1061
+ pcbuild_path : pathlib .Path ,
1062
+ configuration : str ,
1063
+ platform : str ,
1064
+ static : bool ,
1055
1065
):
1056
1066
python_version = DOWNLOADS ["cpython-3.7" ]["version" ]
1057
1067
@@ -1066,8 +1076,8 @@ def run_msbuild(
1066
1076
"/verbosity:normal" ,
1067
1077
"/property:IncludeExternals=true" ,
1068
1078
"/property:IncludeSSL=true" ,
1069
- # TODO support Tkinter
1070
- "/property:IncludeTkinter=false" ,
1079
+ # TODO support tkinter in static builds.
1080
+ "/property:IncludeTkinter=%s" % ( " false" if static else "true" ) ,
1071
1081
# TODO compile test extensions so we can get PGO benefits of tested code.
1072
1082
"/property:IncludeTests=false" ,
1073
1083
"/property:OverrideVersion=%s" % python_version ,
@@ -1236,6 +1246,9 @@ def collect_python_build_artifacts(
1236
1246
extension_projects = set ()
1237
1247
1238
1248
for extension , entry in CONVERT_TO_BUILTIN_EXTENSIONS .items ():
1249
+ if static and entry .get ("ignore_static" ):
1250
+ continue
1251
+
1239
1252
extension_projects .add (extension )
1240
1253
if static :
1241
1254
depends_projects |= set (entry .get ("static_depends" , []))
@@ -1388,14 +1401,23 @@ def find_additional_dependencies(project: pathlib.Path):
1388
1401
)
1389
1402
1390
1403
if ext in EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY :
1391
- download_entry = DOWNLOADS [EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY [ext ]]
1404
+ licenses = set ()
1405
+ license_paths = set ()
1406
+ license_public_domain = False
1392
1407
1393
- # This will raise if no license metadata defined. This is
1394
- # intentional because EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY is
1395
- # manually curated and we want to fail fast.
1396
- entry ["licenses" ] = download_entry ["licenses" ]
1397
- entry ["license_paths" ] = ["licenses/%s" % download_entry ["license_file" ]]
1398
- entry ["license_public_domain" ] = download_entry .get ("license_public_domain" )
1408
+ for name in EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY [ext ]:
1409
+ download_entry = DOWNLOADS [name ]
1410
+
1411
+ # This will raise if no license metadata defined. This is
1412
+ # intentional because EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY is
1413
+ # manually curated and we want to fail fast.
1414
+ licenses |= set (download_entry ["licenses" ])
1415
+ license_paths .add ("licenses/%s" % download_entry ["license_file" ])
1416
+ license_public_domain = download_entry .get ("license_public_domain" )
1417
+
1418
+ entry ["licenses" ] = list (sorted (licenses ))
1419
+ entry ["license_paths" ] = list (sorted (license_paths ))
1420
+ entry ["license_public_domain" ] = license_public_domain
1399
1421
1400
1422
res ["extensions" ][ext ] = [entry ]
1401
1423
@@ -1543,6 +1565,7 @@ def build_cpython(arch: str, pgo=False, build_mode="static"):
1543
1565
pcbuild_path ,
1544
1566
configuration = "PGInstrument" ,
1545
1567
platform = build_platform ,
1568
+ static = static ,
1546
1569
)
1547
1570
1548
1571
# build-windows.py sets some environment variables which cause the
@@ -1600,13 +1623,21 @@ def build_cpython(arch: str, pgo=False, build_mode="static"):
1600
1623
)
1601
1624
1602
1625
run_msbuild (
1603
- msbuild , pcbuild_path , configuration = "PGUpdate" , platform = build_platform
1626
+ msbuild ,
1627
+ pcbuild_path ,
1628
+ configuration = "PGUpdate" ,
1629
+ platform = build_platform ,
1630
+ static = static ,
1604
1631
)
1605
1632
artifact_config = "PGUpdate"
1606
1633
1607
1634
else :
1608
1635
run_msbuild (
1609
- msbuild , pcbuild_path , configuration = "Release" , platform = build_platform
1636
+ msbuild ,
1637
+ pcbuild_path ,
1638
+ configuration = "Release" ,
1639
+ platform = build_platform ,
1640
+ static = static ,
1610
1641
)
1611
1642
artifact_config = "Release"
1612
1643
@@ -1639,6 +1670,10 @@ def build_cpython(arch: str, pgo=False, build_mode="static"):
1639
1670
1640
1671
if static :
1641
1672
args .append ("--flat-dlls" )
1673
+ else :
1674
+ args .extend (
1675
+ ["--include-idle" , "--include-tcltk" ,]
1676
+ )
1642
1677
1643
1678
exec_and_log (
1644
1679
args , pcbuild_path , os .environ ,
@@ -1721,6 +1756,9 @@ def build_cpython(arch: str, pgo=False, build_mode="static"):
1721
1756
"license_path" : "licenses/LICENSE.cpython.txt" ,
1722
1757
}
1723
1758
1759
+ if not static :
1760
+ python_info ["tcl_library_path" ] = "install/tcl"
1761
+
1724
1762
with (out_dir / "python" / "PYTHON.json" ).open ("w" , encoding = "utf8" ) as fh :
1725
1763
json .dump (python_info , fh , sort_keys = True , indent = 4 )
1726
1764
0 commit comments