summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhangenuit@gmail.com <hangenuit@gmail.com>2011-09-14 23:45:28 +0200
committerCharles Harris <charlesr.harris@gmail.com>2011-10-04 11:29:32 -0600
commita069994282979fee21cacd079f2cf0da4bac8286 (patch)
tree70ac8e2c28163c7ce81f7240722cf3b4f63d7b10
parentf8e383499b37ef517044903293733328dc9e581c (diff)
downloadnumpy-a069994282979fee21cacd079f2cf0da4bac8286.tar.gz
BUG: DLL finder should also look in WinSxS directory.
-rw-r--r--numpy/distutils/mingw32ccompiler.py15
1 files changed, 13 insertions, 2 deletions
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':