[pypy-svn] r64986 - pypy/branch/pyjitpl5/pypy/rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Sat May 2 20:53:07 CEST 2009


Author: arigo
Date: Sat May  2 20:53:07 2009
New Revision: 64986

Modified:
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
Also respect library_dirs in ll2ctypes.


Modified: pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py	Sat May  2 20:53:07 2009
@@ -821,9 +821,21 @@
         cfunc = None
         not_found = []
         for libname in libraries:
-            libpath = ctypes.util.find_library(libname)
-            if not libpath and os.path.isabs(libname):
-                libpath = libname
+            libpath = None
+            for dir in eci.library_dirs:
+                if sys.platform == "win32":
+                    tryfile = os.path.join(dir, libname + '.dll')
+                elif sys.platform == "darwin":
+                    tryfile = os.path.join(dir, libname + '.dylib')
+                else:
+                    tryfile = os.path.join(dir, libname + '.so')
+                if os.path.isfile(tryfile):
+                    libpath = tryfile
+                    break
+            if not libpath:
+                libpath = ctypes.util.find_library(libname)
+                if not libpath and os.path.isabs(libname):
+                    libpath = libname
             if libpath:
                 dllclass = getattr(ctypes, calling_conv + 'dll')
                 # urgh, cannot pass the flag to dllclass.LoadLibrary



More information about the Pypy-commit mailing list