From: Sebastian Spaeth Date: Tue, 16 Mar 2010 10:52:56 +0000 (+0100) Subject: Find the notmuch shared lib rather than hardode a location X-Git-Tag: 0.3~121^2~100 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=338e68e545bd101c140bfad81f136cc8b74566b3;p=notmuch.git Find the notmuch shared lib rather than hardode a location --HG-- extra : transplant_source : %DEOdF%80%83%3A%3D%98%5C%AE%81%FE%BA%EF%1A%16%82u%E8 --- diff --git a/cnotmuch/globals.py b/cnotmuch/globals.py index 553670a4..611c29ed 100644 --- a/cnotmuch/globals.py +++ b/cnotmuch/globals.py @@ -1,7 +1,14 @@ from ctypes import CDLL, c_char_p, c_int +from ctypes.util import find_library + +#----------------------------------------------------------------------------- #package-global instance of the notmuch library #TODO: lazy load this on first access? -nmlib = CDLL('/usr/local/lib/libnotmuch.so') +so = find_library('notmuch') +if so is None: + raise ImportError("Could not find shared 'notmuch' library.") +nmlib = CDLL(so) +#----------------------------------------------------------------------------- class STATUS(object): SUCCESS = 0