From: Floris Bruynooghe <flub@devork.be>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: Python3 cffi bindings
Date: Fri, 25 Oct 2019 11:57:00 +0200 [thread overview]
Message-ID: <87d0eljggj.fsf@powell.devork.be> (raw)
In-Reply-To: <871rv4ivvj.fsf@tethera.net>
On Tue 22 Oct 2019 at 13:32 -0300, David Bremner wrote:
> David Bremner <david@tethera.net> writes:
>
>> 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,
>>
>
> I think I figured it out. Your 'run' function completely overrides the
> environment. But just adding PATH back seems to do the trick. I'm not
> sure if this is the most idomatic change, but it works:
>
> diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py
> index 1b7bbc35..6a81aa18 100644
> --- a/bindings/python-cffi/tests/conftest.py
> +++ b/bindings/python-cffi/tests/conftest.py
> @@ -33,9 +33,11 @@ def notmuch(maildir):
> cfg_fname = maildir.path / 'notmuch-config'
> cmd = ['notmuch'] + list(args)
> print('Invoking: {}'.format(' '.join(cmd)))
> proc = subprocess.run(cmd,
> timeout=5,
> - env={'NOTMUCH_CONFIG': str(cfg_fname)})
> + env={'PATH':os.environ["PATH"],'NOTMUCH_CONFIG': str(cfg_fname)})
> proc.check_returncode()
> return run
>
This seems reasonable, perhaps even a "env = os.environ.copy();
env['NOTMUCH_CONFIG'] = src(cfg_fname)" is better here so that
LD_LIBRARY_PATH and anything else is kept around.
next prev parent reply other threads:[~2019-10-25 9:57 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
2019-10-22 16:32 ` David Bremner
2019-10-25 9:57 ` Floris Bruynooghe [this message]
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=87d0eljggj.fsf@powell.devork.be \
--to=flub@devork.be \
--cc=david@tethera.net \
--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).