File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,13 +296,24 @@ def generate_def(dll, dfile):
296296 d .close ()
297297
298298def find_dll (dll_name ):
299+
300+ def _find_dll_in_winsxs (dll_name ):
301+ # Walk through the WinSxS directory to find the dll.
302+ winsxs_path = os .path .join (os .environ ['WINDIR' ], 'winsxs' )
303+ if not os .path .exists (winsxs_path ):
304+ return None
305+ for root , dirs , files in os .walk (winsxs_path ):
306+ if dll_name in files :
307+ return os .path .join (root , dll_name )
308+ return None
309+
299310 # First, look in the Python directory, then scan PATH for
300- # the given dll name.
311+ # the given dll name. Lastly, look in the WinSxS directory.
301312 for path in [sys .prefix ] + os .environ ['PATH' ].split (';' ):
302313 filepath = os .path .join (path , dll_name )
303314 if os .path .exists (filepath ):
304315 return os .path .abspath (filepath )
305- return None
316+ return _find_dll_in_winsxs ( dll_name )
306317
307318def build_msvcr_library (debug = False ):
308319 if os .name != 'nt' :
You can’t perform that action at this time.
0 commit comments