Commit 059a084d by devttys0

Consolidated find_library code

parent c043dfe2
...@@ -117,7 +117,9 @@ class Library(object): ...@@ -117,7 +117,9 @@ class Library(object):
try: try:
prefix = open(self.settings.system.prefix, 'r').read().strip() prefix = open(self.settings.system.prefix, 'r').read().strip()
except: except KeyboardInterrupt as e:
raise e
except Exception:
prefix = '' prefix = ''
if isinstance(libraries, str): if isinstance(libraries, str):
...@@ -126,16 +128,16 @@ class Library(object): ...@@ -126,16 +128,16 @@ class Library(object):
for library in libraries: for library in libraries:
system_paths = { system_paths = {
'linux' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library], 'linux' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library],
'linux2' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library], 'cygwin' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library],
'linux3' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library], 'win32' : [os.path.join(prefix, 'lib%s.dll' % library), '%s.dll' % library],
'darwin' : [os.path.join(prefix, 'lib', 'lib%s.dylib' % library), '/opt/local/lib/lib%s.dylib' % library, 'darwin' : [os.path.join(prefix, 'lib', 'lib%s.dylib' % library), '/opt/local/lib/lib%s.dylib' % library,
'/usr/local/lib/lib%s.dylib' % library, '/usr/local/lib/lib%s.dylib' % library,
] + glob.glob('/usr/local/Cellar/lib%s/*/lib/lib%s.dylib' % (library, library)), ] + glob.glob('/usr/local/Cellar/lib%s/*/lib/lib%s.dylib' % (library, library)),
'cygwin' : [os.path.join(prefix, 'lib', 'lib%s.so' % library), '/usr/local/lib/lib%s.so' % library],
'win32' : [os.path.join(prefix, 'lib%s.dll' % library), '%s.dll' % library]
} }
for i in range(2, 4):
system_paths['linux%d' % i] = system_paths['linux']
# Search the common install directories first; these are usually not in the library search path # 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 # Search these *first*, since a) they are the most likely locations and b) there may be a
# discrepency between where ctypes.util.find_library and ctypes.cdll.LoadLibrary search for libs. # discrepency between where ctypes.util.find_library and ctypes.cdll.LoadLibrary search for libs.
......
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