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

Frank LENORMAND lenormf.ml at gmail.com
Fri Jun 19 05:26:13 PDT 2020


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.

Regards,
-- 
Frank LENORMAND


More information about the notmuch mailing list