3636TCLTK_DIRS_ONLY = FileNameSet ("tkinter" , "turtledemo" )
3737TCLTK_FILES_ONLY = FileNameSet ("turtle.py" )
3838
39- EXCLUDE_FROM_PYDS = FileStemSet ("python*" , "pyshellext" )
39+ EXCLUDE_FROM_PYDS = FileStemSet ("python*" , "pyshellext" , "vcruntime*" )
4040EXCLUDE_FROM_LIB = FileNameSet ("*.pyc" , "__pycache__" , "*.pickle" )
4141EXCLUDE_FROM_PACKAGED_LIB = FileNameSet ("readme.txt" )
4242EXCLUDE_FROM_COMPILE = FileNameSet ("badsyntax_*" , "bad_*" )
@@ -142,6 +142,14 @@ def in_build(f, dest="", new_name=None):
142142 for item in in_build (PYTHON_DLL_NAME ):
143143 yield item
144144
145+ # Explicitly move vcruntime.dlls to the Main directory so they are available at startup
146+ found_any = False
147+ for dest , src in rglob (ns .build , "vcruntime*.dll" ):
148+ found_any = True
149+ yield dest , src
150+ if not found_any :
151+ log_error ("Failed to locate vcruntime DLL in the build." )
152+
145153 yield "LICENSE" , "LICENSE"
146154
147155 for dest , src in rglob (ns .build , ("*.pyd" , "*.dll" )):
@@ -153,7 +161,9 @@ def in_build(f, dest="", new_name=None):
153161 continue
154162 if src in TCLTK_PYDS_ONLY and not ns .include_tcltk :
155163 continue
156-
164+ # Explicitly remove files containing vcruntime from the DLLs subdirectory.
165+ if "vcruntime" in src :
166+ continue
157167 for item in in_build (os .path .basename (src ), dest = "" if ns .flat_dlls else "DLLs/" ):
158168 yield item
159169
0 commit comments