Commit 887e9292 by devttys0

Modified C.py to search /usr/local/lib first.

parent 73b9c415
...@@ -124,15 +124,19 @@ class Library(object): ...@@ -124,15 +124,19 @@ class Library(object):
'win32' : ['%s.dll' % library] 'win32' : ['%s.dll' % library]
} }
lib_path = ctypes.util.find_library(library) # Search the common install directories first; these are usually not in the library search path
# Search these *first*, since a) they are the most likely locations and b) there may be a
# If ctypes failed to find the library, check the common paths listed in system_paths # discrepency between where ctypes.util.find_library and ctypes.cdll.LoadLibrary search for libs.
if not lib_path:
for path in system_paths[sys.platform]: for path in system_paths[sys.platform]:
if os.path.exists(path): if os.path.exists(path):
lib_path = path lib_path = path
break break
# If we failed to find the library, check the standard library search paths
if not lib_path:
lib_path = ctypes.util.find_library(library)
# If we still couldn't find the library, error out
if not lib_path: if not lib_path:
raise Exception("Failed to locate library '%s'" % library) raise Exception("Failed to locate library '%s'" % library)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment