Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a069994

Browse files
87charris
authored andcommitted
BUG: DLL finder should also look in WinSxS directory.
1 parent f8e3834 commit a069994

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

numpy/distutils/mingw32ccompiler.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,24 @@ def generate_def(dll, dfile):
296296
d.close()
297297

298298
def 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

307318
def build_msvcr_library(debug=False):
308319
if os.name != 'nt':

0 commit comments

Comments
 (0)