[PATCH] python-cffi: read version from notmuch version file

Floris Bruynooghe flub at devork.be
Mon Jun 22 14:45:01 PDT 2020


On Fri 19 Jun 2020 at 15:26 +0300, Frank LENORMAND wrote:

> On Fri Jun 19 12:46:28 2020, Floris Bruynooghe wrote:
>> This keeps it in sync with the main notmuch version which is less
>> confusing to users.
>> ---
>>  bindings/python-cffi/setup.py | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/bindings/python-cffi/setup.py b/bindings/python-cffi/setup.py
>> index 37918e3d..1effcfc6 100644
>> --- a/bindings/python-cffi/setup.py
>> +++ b/bindings/python-cffi/setup.py
>> @@ -1,9 +1,17 @@
>> +import pathlib
>> +
>>  import setuptools
>>  
>>  
>> +THIS_FILE = pathlib.Path(__file__).absolute()
>> +PROJECT_ROOT = THIS_FILE.parent.parent.parent
>> +with open(PROJECT_ROOT.joinpath('version')) as fp:
>> +    VERSION = fp.read().strip()
>> +
>> +
>>  setuptools.setup(
>>      name='notmuch2',
>> -    version='0.1',
>> +    version=VERSION,
>>      description='Pythonic bindings for the notmuch mail database using CFFI',
>>      author='Floris Bruynooghe',
>>      author_email='flub at devork.be',
>> -- 
>> 2.27.0
>
> It seems that this strategy doesn't work well when the user runs
> `pip install .` in the `bindings/python-cffi` directory.
>
> Apparently all the files are copied to a temporary directory first:
>
> https://travis-ci.com/github/pazz/alot/jobs/351377760#L708-L710
>
> It doesn't happen with the original bindings, probably because the version
> number is stored in `bindings/python/notmuch/version.py`, which is also
> copied when `pip` runs.

Ouch, I only tested pip install -e, which does work.  But indeed a plain
pip install no longer works which is pretty bad.

I guess we could either revert this and do the same sed hackery as the
other bindings, or copy the version file into bindings/python-cffi and
have it loaded in the same way as now.  It would still have to be kept
in sync there sadly.


More information about the notmuch mailing list