[Numpy-svn] r6153 - branches/numpy-mingw-w64/numpy/distutils

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Dec 19 03:06:10 EST 2008


Author: cdavid
Date: 2008-12-19 02:06:06 -0600 (Fri, 19 Dec 2008)
New Revision: 6153

Modified:
   branches/numpy-mingw-w64/numpy/distutils/mingw32ccompiler.py
Log:
Add a function to find python dll on windows.

Modified: branches/numpy-mingw-w64/numpy/distutils/mingw32ccompiler.py
===================================================================
--- branches/numpy-mingw-w64/numpy/distutils/mingw32ccompiler.py	2008-12-19 07:52:43 UTC (rev 6152)
+++ branches/numpy-mingw-w64/numpy/distutils/mingw32ccompiler.py	2008-12-19 08:06:06 UTC (rev 6153)
@@ -189,6 +189,29 @@
     # 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
     """




More information about the Numpy-svn mailing list