44The windows build process.
55"""
66import glob
7+ import json
78import logging
89import os
910import pathlib
@@ -120,19 +121,34 @@ def build_python(env, dirs, logfp):
120121 # XZ-Utils
121122 if env ["RELENV_PY_MAJOR_VERSION" ] in ["3.10" , "3.11" , "3.12" , "3.13" , "3.14" ]:
122123 version = "5.6.2"
124+ url = f"https://github.com/tukaani-project/xz/releases/download/v{ version } /xz-{ version } .tar.xz"
125+ sha256 = "8bfd20c0e1d86f0402f2497cfa71c6ab62d4cd35fd704276e3140bfb71414519"
126+ ref_loc = f"cpe:2.3:a:tukaani:xz:{ version } :*:*:*:*:*:*:*"
123127 target_dir = externals_dir / f"xz-{ version } "
124128 if not target_dir .exists ():
125129 update_props (dirs .source , r"xz-\d+.\d+.\d+" , f"xz-{ version } " )
126- url = f"https://github.com/tukaani-project/xz/releases/download/v{ version } /xz-{ version } .tar.xz"
127130 get_externals_source (externals_dir = externals_dir , url = url )
128131 # Starting with version v5.5.0, XZ-Utils removed the ability to compile
129132 # with MSBuild. We are bringing the config.h from the last version that
130133 # had it, 5.4.7
131- config_file = target_dir / "windows" / "config.h"
132134 config_file = target_dir / "src" / "common" / "config.h"
133135 config_file_source = dirs .root / "_resources" / "xz" / "config.h"
134136 if not config_file .exists ():
135137 shutil .copy (str (config_file_source ), str (config_file ))
138+ # Update externals.spdx.json with the correct version, url, and hash
139+ # This became a thing in 3.12
140+ if env ["RELENV_PY_MAJOR_VERSION" ] in ["3.12" , "3.13" , "3.14" ]:
141+ spdx_json = dirs .source / "Misc" / "externals.spdx.json"
142+ with open (str (spdx_json ), "r" ) as f :
143+ data = json .load (f )
144+ for pkg in data ["packages" ]:
145+ if pkg ["name" ] == "xz" :
146+ pkg ["versionInfo" ] = version
147+ pkg ["downloadLocation" ] = url
148+ pkg ["checksums" ][0 ]["checksumValue" ] = sha256
149+ pkg ["externalRefs" ][0 ]["referenceLocator" ] = ref_loc
150+ with open (str (spdx_json ), "w" ) as f :
151+ json .dump (data , f , indent = 2 )
136152
137153 arch_to_plat = {
138154 "amd64" : "x64" ,
@@ -146,7 +162,6 @@ def build_python(env, dirs, logfp):
146162 "-p" ,
147163 plat ,
148164 "--no-tkinter" ,
149- "-vv" ,
150165 ]
151166
152167 log .info ("Start PCbuild" )
0 commit comments