Find the notmuch shared lib rather than hardode a location
authorSebastian Spaeth <sebastian@sspaeth.de>
Tue, 16 Mar 2010 10:52:56 +0000 (11:52 +0100)
committerSebastian Spaeth <sebastian@sspaeth.de>
Tue, 16 Mar 2010 10:52:56 +0000 (11:52 +0100)
--HG--
extra : transplant_source : %DEOdF%80%83%3A%3D%98%5C%AE%81%FE%BA%EF%1A%16%82u%E8

cnotmuch/globals.py

index 553670a49c5c1460a1c77c24ff3b144e5cf2a05a..611c29ed8fcee4f93cc27503d81536801c935c37 100644 (file)
@@ -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