[notmuch] [PATCH] SWIG bindings

Subject: [notmuch] [PATCH] SWIG bindings

Date: Mon, 25 Jan 2010 22:53:17 -0500

To: notmuch@notmuchmail.org

Cc:

From: Ben Gamari


Hey all,

Here's the latest version of my patch adding SWIG interface generation to
notmuch. It has been rebased on the shared-library patches I sent over earlier
this week, so you'll need those as well. Unfortunately, SWIG has effectively no
support for exposing notmuch's C-style object-oriented interface in a
reasonable manner. Therefore, I use SWIG to generate a set of low-level
bindings which is then wrapped with a light-weight module properly exposing the
functions in their intended class structure. This seems like a fairly good
solution, given the wide variety of capabilities possessed by modern high-level
languages.

As you can see, it all works quite nicely,

    [2252 ben@ben-laptop swig(swig)] $ python 
    Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) 
    [GCC 4.4.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from notmuch import Database
    >>> db=Database.open('/home/ben/.mail', Database.MODE_READ_ONLY)
    >>> for tag in db.get_all_tags(): print tag
    ... 
    attachment
    inbox
    unread
    
Let me know what you think. Thanks!

- Ben

Thread: