From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 25 Jun 2013 15:21:59 +0000 (+0200) Subject: Re: [RFC PATCH] Python bindings: CDLL("libnotmuch.3.dylib") on Darwin X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=68fb4fa5862edcbcb8a383dd0eb320b3676db044;p=notmuch-archives.git Re: [RFC PATCH] Python bindings: CDLL("libnotmuch.3.dylib") on Darwin --- diff --git a/14/1c71e7db1ad2b9e80fbbfeeb28a0f1bbab1f94 b/14/1c71e7db1ad2b9e80fbbfeeb28a0f1bbab1f94 new file mode 100644 index 000000000..fcf5dd8d9 --- /dev/null +++ b/14/1c71e7db1ad2b9e80fbbfeeb28a0f1bbab1f94 @@ -0,0 +1,109 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4EFED431FB6 + for ; Tue, 25 Jun 2013 08:22:18 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id XBLlpd3GoFJJ for ; + Tue, 25 Jun 2013 08:22:11 -0700 (PDT) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 0EE07431FAF + for ; Tue, 25 Jun 2013 08:22:11 -0700 (PDT) +Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id A64D0691115 + for ; Tue, 25 Jun 2013 17:22:02 +0200 (CEST) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 29C18DF2A4; Tue, 25 Jun 2013 17:22:01 +0200 (CEST) +Received: from thinkbox.jade-hamburg.de (unknown + [IPv6:2002:55b7:be4:1:216:d3ff:fe3e:5058]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id 99232DF29F; + Tue, 25 Jun 2013 17:22:00 +0200 (CEST) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80) + (envelope-from ) + id 1UrV4B-00056a-C0; Tue, 25 Jun 2013 17:21:59 +0200 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +To: Tomi Ollila , notmuch@notmuchmail.org +From: Justus Winter <4winter@informatik.uni-hamburg.de> +In-Reply-To: <1372171016-11935-1-git-send-email-tomi.ollila@iki.fi> +References: <1372171016-11935-1-git-send-email-tomi.ollila@iki.fi> +Message-ID: <20130625152159.17799.36764@thinkbox.jade-hamburg.de> +User-Agent: alot/0.3.4 +Subject: Re: [RFC PATCH] Python bindings: CDLL("libnotmuch.3.dylib") on Darwin +Date: Tue, 25 Jun 2013 17:21:59 +0200 +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 25 Jun 2013 15:22:18 -0000 + +Quoting Tomi Ollila (2013-06-25 16:36:56) +> Use os.uname() to check for 'Darwin' and load "libnotmuch.3.dylib" +> instead of "libnotmuch.so.3" if that is the case. +> --- +> = + +> This is followup to thread starting from +> = + +> id:1369540418-94177-1-git-send-email-Julian@GrayVines.com +> = + +> For anyone interested: this is basically no-overhead addition as ctypes +> already loads os module (is "available" as ctypes._os) -- Comparison using +> strace(1) showed that uname system call is used in addition to other proc= +essing. +> = + +> This patch is modeled after _lb_'s comments on IRC: +> = + +> < _lb_> nmlib =3D CDLL("libnotmuch.so.3") needs to be replaced with +> nmlib =3D CDLL("libnotmuch.3.dylib") in OSX +> < _lb_> Works like a charm! Mmm... I'll have to subscribe to the list +> to send the patch... +> < _lb_> I guess the quid of the question is to have an os detection +> if so it loads the right lib? +> = + +> ... a few days ago, but the patch didn't arrive yet ;D +> = + +> I tested that this still works on Linux, but did not test on Mac OS X; +> also I did not think much how to handle the importing and the if test. +> = + +> Anyone using Mac care to take over -- you are probably more interested +> of getting this thing to work :D + +Looks good, though I'd prefer not to do the from..import +thing. os.uname is just as short and more concise, you can see where +the uname function comes from. + +If anyone on OSX confirms that this works I'll merge the patch. + +Justus