diff options
author | David Cournapeau <cournape@gmail.com> | 2008-12-19 08:06:06 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-12-19 08:06:06 +0000 |
commit | 28e95dbda19f6d438a883c280fe21c9e40fa7f46 (patch) | |
tree | 7e364fae7326205f73b0fd819b565b36310f8a44 | |
parent | 0746f06c55c49b1efeecd09eaa6a4aa0ed1e146c (diff) | |
download | numpy-28e95dbda19f6d438a883c280fe21c9e40fa7f46.tar.gz |
Add a function to find python dll on windows.
-rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 9c96451bc..310d44ce4 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -189,6 +189,29 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler): # object_filenames () +def find_python_dll(): + maj, min, micro = [int(i) for i in sys.version_info[:3]] + dllname = 'python%d%d.dll' % (maj, min) + print "Looking for %s" % dllname + + # We can't do much here: + # - find it in python main dir + # - in system32, + # - ortherwise (Sxs), I don't know how to get it. + lib_dirs = [] + lib_dirs.append(os.path.join(sys.prefix, 'lib')) + try: + lib_dirs.append(os.path.join(os.environ['SYSTEM_ROOT'], 'system32')) + except KeyError: + pass + + for d in lib_dirs: + dll = os.path.join(d, dllname) + if os.path.exists(dll): + return dll + + raise ValueError("%s not found in %s" % (dllname, lib_dirs)) + def build_import_library(): """ Build the import libraries for Mingw32-gcc on Windows """ |