Re: Python3 cffi bindings

Subject: Re: Python3 cffi bindings

Date: Thu, 17 Oct 2019 19:35:19 +0200

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Floris Bruynooghe


On Mon 14 Oct 2019 at 09:42 -0300, David Bremner wrote:

> David Bremner <david@tethera.net> writes:
>
>> The shim in
>> T391-python-cffi.sh doesn't work for me, it doesn't manage to set
>> PYTHONPATH so that notdb is importable.

Ah yes, I tested this shim while activating a venv with the extension
installed using `pip -e .`.

> I should have mentioned that if I manually set python path with
> something like
>
> $ PYTHONPATH=`pwd`/build/lib.linux-x86_64-3.7:$PYTHONPATH pytest-3
>
> it works OK.  Is there a simple/reliable way of calculating the path
> lib.linux-x86_64-3.7?

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

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?

Cheers,
Floris

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: