@@ -135,8 +135,8 @@ def find_msvc_with_vswhere_exe() -> list[Tool | None]:
135135 LIB .append (ucrt / "lib" / ucrt_version / "ucrt" / "x64" )
136136 INCLUDE .append (ucrt / "include" / ucrt_version / "ucrt" )
137137
138- ucrt_exe_paths = [ucrt_bin_path / exe for exe in UCRT_EXE_NAMES ]
139- ucrt_exe_paths = [exe if exe .exists () else None for exe in ucrt_exe_paths ]
138+ ucrt_exe_paths_not_checked = [ucrt_bin_path / exe for exe in UCRT_EXE_NAMES ]
139+ ucrt_exe_paths = [exe if exe .exists () else None for exe in ucrt_exe_paths_not_checked ]
140140 else :
141141 ucrt_exe_paths = [None for exe in UCRT_EXE_NAMES ]
142142
@@ -150,7 +150,7 @@ def find_msvc_with_vswhere_exe() -> list[Tool | None]:
150150 INCLUDE .append (sdk / "include" / sdk_version / "shared" )
151151
152152 return [
153- Tool (exe = exe , LIB = LIB , PATH = PATH , INCLUDE = INCLUDE )
153+ None if exe == None else Tool (exe = exe , LIB = LIB , PATH = PATH , INCLUDE = INCLUDE )
154154 for exe in vc_exe_paths + ucrt_exe_paths
155155 ]
156156
@@ -310,8 +310,8 @@ def find_with_ewdk(ewdkdir: Path) -> list[Tool | None]:
310310 LIB .append (ucrt / "lib" / ucrt_version / "ucrt" / "x64" )
311311 INCLUDE .append (ucrt / "include" / ucrt_version / "ucrt" )
312312
313- ucrt_exe_paths = [ucrt_bin_path / exe for exe in UCRT_EXE_NAMES ]
314- ucrt_exe_paths = [exe if exe .exists () else None for exe in ucrt_exe_paths ]
313+ ucrt_exe_paths_not_checked = [ucrt_bin_path / exe for exe in UCRT_EXE_NAMES ]
314+ ucrt_exe_paths = [exe if exe .exists () else None for exe in ucrt_exe_paths_not_checked ]
315315 else :
316316 ucrt_exe_paths = [None for exe in UCRT_EXE_NAMES ]
317317
@@ -326,7 +326,7 @@ def find_with_ewdk(ewdkdir: Path) -> list[Tool | None]:
326326 INCLUDE .append (sdk / "include" / sdk_version / "shared" )
327327
328328 return [
329- Tool (exe = bin_path / exe , LIB = LIB , PATH = PATH , INCLUDE = INCLUDE )
329+ None if exe == None else Tool (exe = bin_path / exe , LIB = LIB , PATH = PATH , INCLUDE = INCLUDE )
330330 for exe in vc_exe_paths + ucrt_exe_paths
331331 ]
332332
@@ -358,12 +358,18 @@ def main() -> None:
358358 find_msvc_with_vswhere_exe ()
359359 )
360360
361- write_tool_json (output .cl , cl_exe )
362- write_tool_json (output .cvtres , cvtres_exe )
363- write_tool_json (output .lib , lib_exe )
364- write_tool_json (output .ml64 , ml64_exe )
365- write_tool_json (output .link , link_exe )
366- write_tool_json (output .rc , rc_exe )
361+ if output .cl and cl_exe :
362+ write_tool_json (output .cl , cl_exe )
363+ if output .cvtres and cvtres_exe :
364+ write_tool_json (output .cvtres , cvtres_exe )
365+ if output .lib and lib_exe :
366+ write_tool_json (output .lib , lib_exe )
367+ if output .ml64 and ml64_exe :
368+ write_tool_json (output .ml64 , ml64_exe )
369+ if output .link and link_exe :
370+ write_tool_json (output .link , link_exe )
371+ if output .rc and rc_exe :
372+ write_tool_json (output .rc , rc_exe )
367373
368374 if output .csc :
369375 csc_exe = find_roslyn_with_vswhere_exe ()
0 commit comments