From 338e68e545bd101c140bfad81f136cc8b74566b3 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Tue, 16 Mar 2010 11:52:56 +0100 Subject: [PATCH] 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 --- cnotmuch/globals.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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