--- /dev/null
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id E98EF431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Jun 2013 07:37:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 0On4hGCDs-pb for <notmuch@notmuchmail.org>;\r
+ Tue, 25 Jun 2013 07:37:16 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9452B431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Jun 2013 07:37:16 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 5FB7C1000B2; Tue, 25 Jun 2013 17:37:07 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH] Python bindings: CDLL("libnotmuch.3.dylib") on Darwin\r
+Date: Tue, 25 Jun 2013 17:36:56 +0300\r
+Message-Id: <1372171016-11935-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 25 Jun 2013 14:37:25 -0000\r
+\r
+Use os.uname() to check for 'Darwin' and load "libnotmuch.3.dylib"\r
+instead of "libnotmuch.so.3" if that is the case.\r
+---\r
+\r
+This is followup to thread starting from\r
+\r
+ id:1369540418-94177-1-git-send-email-Julian@GrayVines.com\r
+\r
+For anyone interested: this is basically no-overhead addition as ctypes\r
+already loads os module (is "available" as ctypes._os) -- Comparison using\r
+strace(1) showed that uname system call is used in addition to other processing.\r
+\r
+This patch is modeled after _lb_'s comments on IRC:\r
+\r
+< _lb_> nmlib = CDLL("libnotmuch.so.3") needs to be replaced with\r
+ nmlib = CDLL("libnotmuch.3.dylib") in OSX\r
+< _lb_> Works like a charm! Mmm... I'll have to subscribe to the list\r
+ to send the patch...\r
+< _lb_> I guess the quid of the question is to have an os detection\r
+ if so it loads the right lib?\r
+\r
+... a few days ago, but the patch didn't arrive yet ;D\r
+\r
+I tested that this still works on Linux, but did not test on Mac OS X;\r
+also I did not think much how to handle the importing and the if test.\r
+\r
+Anyone using Mac care to take over -- you are probably more interested\r
+of getting this thing to work :D\r
+\r
+Tomi\r
+\r
+ bindings/python/notmuch/globals.py | 6 +++++-\r
+ 1 file changed, 5 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py\r
+index c7632c3..2deb87c 100644\r
+--- a/bindings/python/notmuch/globals.py\r
++++ b/bindings/python/notmuch/globals.py\r
+@@ -22,7 +22,11 @@ from ctypes import CDLL, Structure, POINTER\r
+ #-----------------------------------------------------------------------------\r
+ #package-global instance of the notmuch library\r
+ try:\r
+- nmlib = CDLL("libnotmuch.so.3")\r
++ from os import uname\r
++ if uname()[0] == 'Darwin':\r
++ nmlib = CDLL("libnotmuch.3.dylib")\r
++ else:\r
++ nmlib = CDLL("libnotmuch.so.3")\r
+ except:\r
+ raise ImportError("Could not find shared 'notmuch' library.")\r
+ \r
+-- \r
+1.8.0\r
+\r