Python3 cffi bindings

Gaute Hope eg at gaute.vetsj.com
Sun Nov 17 10:01:14 PST 2019


On Sun, Nov 17, 2019 at 6:14 PM Floris Bruynooghe <flub at devork.be> wrote:
>
> Hi Gaute,
>
> Thanks for trying this out!
>
> On Mon 04 Nov 2019 at 11:27 +0100, Gaute Hope wrote:
> > I just checked out the wip/cffi branch on git.notmuch.org with the
> > purpose of porting Lieer (https://github.com/gauteh/lieer). There
> > seems to be some missing functionality: `Database.get_directory()`
> > specifically.
>
> Yeah, I didn't add that yet because I don't fully understand how it
> should be used.  Specifically I don't know where one might get a
> pathname from to pass to .get_directory() and thus whether the API would
> be cleaner to just return a reasonable directory object from whatever
> location that might be.  Maybe notmuch_database_get_path() is the only
> entrypoint here and you can get further by listing files and directories
> from it?  But maybe people then use the filesystem directly to find a
> directory and create the directories ad-hoc.

If I understand correctly then these are the directories known to
notmuch db, so may not correspond to filesystem. Lieer do not modify
Directory objects directly, but others might.

> I grepped lieer but I think you only use it in one place?  And if I
> understand it correctly you only do this to check if your mailstore/cwd
> is inside the notmuch database.  I.e. this is equivalent to checking if
> your mailstore/cwd has notmuch2.Database.path as prefix which you could
> easily do directly rather than using the FileError exception from
> .get_directory().

Yes, I think that would work here. I need the path of the directory
later (for the path:.. query). Seems that the current python API
removes the leading path of the database for the argument to
notmuch_database_get_directory(..) -- at least if the notmuch API docs
are correct. I had some reported issues with symlinked directories and
absolute paths, but I don't think any of that would be influenced by
changes like these.

Regards, Gaute


More information about the notmuch mailing list