find_library does not read LD_LIBRARY_PATH, but CDLL does.

This commit is contained in:
Cedric Cabessa 2010-04-05 03:03:51 +02:00
parent dfa9eb8afa
commit f378f45893

View file

@ -3,17 +3,17 @@ from ctypes.util import find_library
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#package-global instance of the notmuch library #package-global instance of the notmuch library
#TODO: lazy load this on first access? try:
so = find_library('notmuch') nmlib = CDLL("libnotmuch.so.1")
if so is None: except:
raise ImportError("Could not find shared 'notmuch' library.") raise ImportError("Could not find shared 'notmuch' library.")
nmlib = CDLL(so)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
class Enum(object): class Enum(object):
"""Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc...""" """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
def __init__(self, names): def __init__(self, names):
for number, name in enumerate(names): for number, name in enumerate(names):
setattr(self, name, number) setattr(self, name, number)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
class Status(Enum): class Status(Enum):