]> git.notmuchmail.org Git - notmuch/blobdiff - cnotmuch/globals.py
Extent pypi documentation. Set version to 0.2.2
[notmuch] / cnotmuch / globals.py
index d9f8d1b465b74b4eff2b3b214fac30e5ba557e8a..fa20ae81e6be43653b572c1479423fc7ac06c5a0 100644 (file)
@@ -3,17 +3,17 @@ from ctypes.util import find_library
 
 #-----------------------------------------------------------------------------
 #package-global instance of the notmuch library
-#TODO: lazy load this on first access?
-so = find_library('notmuch')
-if so is None:
-  raise ImportError("Could not find shared 'notmuch' library.")
-nmlib = CDLL(so)
+try:
+    nmlib = CDLL("libnotmuch.so.1")
+except:
+    raise ImportError("Could not find shared 'notmuch' library.")
+
 #-----------------------------------------------------------------------------
 class Enum(object):
-  """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
-  def __init__(self, names):
-    for number, name in enumerate(names):
-      setattr(self, name, number)
+    """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
+    def __init__(self, names):
+        for number, name in enumerate(names):
+            setattr(self, name, number)
 
 #-----------------------------------------------------------------------------
 class Status(Enum):
@@ -29,6 +29,7 @@ class Status(Enum):
         """
         super(Status, self).__init__(statuslist)
 
+    @classmethod
     def status2str(self, status):
         """Get a string representation of a notmuch_status_t value."""   
         # define strings for custom error messages