From: Tomi Ollila <tomi.ollila@iki.fi>
Date: Tue, 25 Jun 2013 14:36:56 +0000 (+0300)
Subject: Python bindings: CDLL("libnotmuch.3.dylib") on Darwin
X-Git-Tag: 0.16_rc1~17
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=acb079e35726cc421b6a314ab4f26d5eb92feaf1;p=notmuch

Python bindings: CDLL("libnotmuch.3.dylib") on Darwin

Use os.uname() to check for 'Darwin' and load "libnotmuch.3.dylib"
instead of "libnotmuch.so.3" if that is the case.
---

diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
index c7632c32..2deb87cf 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -22,7 +22,11 @@ from ctypes import CDLL, Structure, POINTER
 #-----------------------------------------------------------------------------
 #package-global instance of the notmuch library
 try:
-    nmlib = CDLL("libnotmuch.so.3")
+    from os import uname
+    if uname()[0] == 'Darwin':
+        nmlib = CDLL("libnotmuch.3.dylib")
+    else:
+        nmlib = CDLL("libnotmuch.so.3")
 except:
     raise ImportError("Could not find shared 'notmuch' library.")