unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Floris Bruynooghe <flub@devork.be>, notmuch@notmuchmail.org
Subject: Re: Python3 cffi bindings
Date: Sun, 20 Oct 2019 09:22:38 -0300	[thread overview]
Message-ID: <878spfsj1t.fsf@tethera.net> (raw)
In-Reply-To: <877e53tgvc.fsf@powell.devork.be>

[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]

Floris Bruynooghe <flub@devork.be> writes:
>
> It is possible to run this without installing, but it does need a build
> step since cffi (in the mode used - which is the recommended mode) needs
> to build an extension module.  I did something like this, using my
> debian testing system-installed python
>
> $ export PYTHONPATH=$(pwd)/bindings/python-cffi
> $ pushd bindings/python-cffi
> $ python3 notdb/_build.py  # creates notdb/_capi.cpython-37m-x86_64-linux-gnu.so
> $ popd
> $ pushd test
> $ ./T391-pytest.sh

Yes, I think I arrived at a similar place, except

1) using "python3 setup.py --build-lib build/stage" to build. I'm not
sure which is better, I think it will depend a bit on when we try to get
out of tree builds working. It is a bit nicer to have the build output
out of tree, but then I have to copy the tests.

2) instead of changing PYTHONPATH, use "python3 -m pytest", which picks
up the module in the current directory. 

> Does that more or less work?  One problem with this is that it will pick
> up the system-wide installed notmuch though.  I guess the way to change
> this is by tweaking CFLAGS=-I... LDFLAGS=-L... or so when building?  But
> than you also have the whole RPATH/LD_LIBRARY_PATH stuff going on as
> well.  Does notmuch abstract any of this away already for it's test
> suite?

The LD_LIBRARY_PATH is already set by the test harness, as is PATH (to
find notmuch). It looks like your function notmuch is not respecting
PATH (see attached log). if I hack something like

diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py
index 1b7bbc35..ac17397c 100644
--- a/bindings/python-cffi/tests/conftest.py
+++ b/bindings/python-cffi/tests/conftest.py
@@ -31,7 +31,7 @@ def notmuch(maildir):
         accidentally do this in the unittests.
         """
         cfg_fname = maildir.path / 'notmuch-config'
-        cmd = ['notmuch'] + list(args)
+        cmd = ['../../notmuch'] + list(args)
         print('Invoking: {}'.format(' '.join(cmd)))
         proc = subprocess.run(cmd,

then the tests pass, but this is obviously not a good solution.


[-- Attachment #2: test.output.xz --]
[-- Type: application/x-xz, Size: 5512 bytes --]

  reply	other threads:[~2019-10-20 12:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 21:03 Python3 cffi bindings Floris Bruynooghe
2019-10-08 21:03 ` [PATCH] Introduce CFFI-based python bindings Floris Bruynooghe
2019-10-08 22:24 ` Python3 cffi bindings David Bremner
2019-10-09 18:34   ` Floris Bruynooghe
2019-10-14 12:40 ` David Bremner
2019-10-14 12:42   ` David Bremner
2019-10-17 17:35     ` Floris Bruynooghe
2019-10-20 12:22       ` David Bremner [this message]
2019-10-22 16:32         ` David Bremner
2019-10-25  9:57           ` Floris Bruynooghe
2019-11-04 10:27 ` Gaute Hope
2019-11-16 16:44   ` David Bremner
2019-12-04 20:18     ` Tomi Ollila
2019-11-17 17:14   ` Floris Bruynooghe
2019-11-17 18:01     ` Gaute Hope
2020-10-08  8:13     ` Gaute Hope
2020-10-14 20:23       ` Floris Bruynooghe
2020-10-16  7:19         ` Gaute Hope
2020-10-16  7:24           ` Gaute Hope

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878spfsj1t.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=flub@devork.be \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).