From a069994282979fee21cacd079f2cf0da4bac8286 Mon Sep 17 00:00:00 2001 From: "hangenuit@gmail.com" Date: Wed, 14 Sep 2011 23:45:28 +0200 Subject: BUG: DLL finder should also look in WinSxS directory. --- numpy/distutils/mingw32ccompiler.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'numpy') diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 48a000eb0..68625c6b3 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -296,13 +296,24 @@ def generate_def(dll, dfile): d.close() def find_dll(dll_name): + + def _find_dll_in_winsxs(dll_name): + # Walk through the WinSxS directory to find the dll. + winsxs_path = os.path.join(os.environ['WINDIR'], 'winsxs') + if not os.path.exists(winsxs_path): + return None + for root, dirs, files in os.walk(winsxs_path): + if dll_name in files: + return os.path.join(root, dll_name) + return None + # First, look in the Python directory, then scan PATH for - # the given dll name. + # the given dll name. Lastly, look in the WinSxS directory. for path in [sys.prefix] + os.environ['PATH'].split(';'): filepath = os.path.join(path, dll_name) if os.path.exists(filepath): return os.path.abspath(filepath) - return None + return _find_dll_in_winsxs(dll_name) def build_msvcr_library(debug=False): if os.name != 'nt': -- cgit v1.2.1