@@ -393,13 +393,23 @@ def build_cpython_host(
393393 target_triple : str ,
394394 build_options : list [str ],
395395 dest_archive ,
396+ python_source = None ,
397+ entry_name = None ,
396398):
397399 """Build binutils in the Docker image."""
398- archive = download_entry (entry , DOWNLOADS_PATH )
400+ if not python_source :
401+ python_version = entry ["version" ]
402+ archive = download_entry (entry_name , DOWNLOADS_PATH )
403+ else :
404+ python_version = os .environ ["PYBUILD_PYTHON_VERSION" ]
405+ archive = DOWNLOADS_PATH / ("Python-%s.tar.xz" % python_version )
406+ print ("Compressing %s to %s" % (python_source , archive ))
407+ with archive .open ("wb" ) as fh :
408+ create_tar_from_directory (
409+ fh , python_source , path_prefix = "Python-%s" % python_version
410+ )
399411
400412 with build_environment (client , image ) as build_env :
401- python_version = DOWNLOADS [entry ]["version" ]
402-
403413 build_env .install_toolchain (
404414 BUILD ,
405415 host_platform ,
@@ -434,7 +444,7 @@ def build_cpython_host(
434444
435445 # Set environment variables allowing convenient testing for Python
436446 # version ranges.
437- for v in ("3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" ):
447+ for v in ("3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" , "3.15" ):
438448 normal_version = v .replace ("." , "_" )
439449
440450 if meets_python_minimum_version (python_version , v ):
@@ -706,12 +716,15 @@ def build_cpython(
706716 """Build CPython in a Docker image'"""
707717 parsed_build_options = set (build_options .split ("+" ))
708718 entry_name = "cpython-%s" % version
709- entry = DOWNLOADS [entry_name ]
710719 if not python_source :
720+ entry = DOWNLOADS [entry_name ]
711721 python_version = entry ["version" ]
712722 python_archive = download_entry (entry_name , DOWNLOADS_PATH )
713723 else :
724+ entry = DOWNLOADS .get (entry_name , {})
714725 python_version = os .environ ["PYBUILD_PYTHON_VERSION" ]
726+ entry .setdefault ("licenses" , ["Python-2.0" , "CNRI-Python" ])
727+ entry .setdefault ("python_tag" , "cp" + "" .join (version .split ("." )))
715728 python_archive = DOWNLOADS_PATH / ("Python-%s.tar.xz" % python_version )
716729 print ("Compressing %s to %s" % (python_source , python_archive ))
717730 with python_archive .open ("wb" ) as fh :
@@ -804,7 +817,7 @@ def build_cpython(
804817
805818 # Set environment variables allowing convenient testing for Python
806819 # version ranges.
807- for v in ("3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" ):
820+ for v in ("3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" , "3.15" ):
808821 normal_version = v .replace ("." , "_" )
809822
810823 if meets_python_minimum_version (python_version , v ):
@@ -1024,6 +1037,18 @@ def main():
10241037 log_name = "%s-%s" % (action , host_platform )
10251038 elif args .action .startswith ("cpython-" ) and args .action .endswith ("-host" ):
10261039 log_name = args .action
1040+ elif action .startswith ("cpython-" ):
1041+ version = (
1042+ os .environ ["PYBUILD_PYTHON_VERSION" ]
1043+ if python_source
1044+ else DOWNLOADS [action ]["version" ]
1045+ )
1046+ log_name = "%s-%s-%s-%s" % (
1047+ action ,
1048+ version ,
1049+ target_triple ,
1050+ build_options ,
1051+ )
10271052 else :
10281053 entry = DOWNLOADS [action ]
10291054 log_name = "%s-%s-%s-%s" % (
@@ -1229,14 +1254,21 @@ def main():
12291254 )
12301255
12311256 elif action .startswith ("cpython-" ) and action .endswith ("-host" ):
1257+ entry_name = action [:- 5 ]
1258+ if not python_source :
1259+ entry = DOWNLOADS [entry_name ]
1260+ else :
1261+ entry = DOWNLOADS .get (entry_name , {})
12321262 build_cpython_host (
12331263 client ,
12341264 get_image (client , ROOT , BUILD , docker_image , host_platform ),
1235- action [: - 5 ] ,
1265+ entry ,
12361266 host_platform = host_platform ,
12371267 target_triple = target_triple ,
12381268 build_options = build_options ,
12391269 dest_archive = dest_archive ,
1270+ python_source = python_source ,
1271+ entry_name = entry_name ,
12401272 )
12411273
12421274 elif action in (
@@ -1246,6 +1278,7 @@ def main():
12461278 "cpython-3.12" ,
12471279 "cpython-3.13" ,
12481280 "cpython-3.14" ,
1281+ "cpython-3.15" ,
12491282 ):
12501283 build_cpython (
12511284 settings ,
0 commit comments