This reverts commit 81057164cddf6a5c1d4c30a23767c4de8e615c1c. That version turns out not to work with some variety of pip install. --- bindings/python-cffi/setup.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/bindings/python-cffi/setup.py b/bindings/python-cffi/setup.py index 1effcfc6..37918e3d 100644 --- a/bindings/python-cffi/setup.py +++ b/bindings/python-cffi/setup.py @@ -1,17 +1,9 @@ -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=VERSION, + version='0.1', description='Pythonic bindings for the notmuch mail database using CFFI', author='Floris Bruynooghe', author_email='flub@devork.be', -- 2.27.0
Copy machinery from the older python bindings --- Makefile.global | 1 + Makefile.local | 2 +- bindings/python-cffi/notmuch2/version.py | 3 +++ bindings/python-cffi/setup.py | 9 ++++++++- bindings/python/setup.py | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 bindings/python-cffi/notmuch2/version.py diff --git a/Makefile.global b/Makefile.global index 0aee5876..26d9491f 100644 --- a/Makefile.global +++ b/Makefile.global @@ -47,6 +47,7 @@ SHA256_FILE=$(TAR_FILE).sha256.asc DETACHED_SIG_FILE=$(TAR_FILE).asc PV_FILE=bindings/python/notmuch/version.py +PV_FILE2=bindings/python-cffi/notmuch2/version.py # Smash together user's values with our extra values STD_CFLAGS := -std=gnu99 diff --git a/Makefile.local b/Makefile.local index 586cdf75..4b9dd0be 100644 --- a/Makefile.local +++ b/Makefile.local @@ -53,7 +53,7 @@ dist: $(TAR_FILE) update-versions: sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \ -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \ - ${PV_FILE} + ${PV_FILE} ${PV_FILE2} # We invoke make recursively only to force ordering of our phony # targets in the case of parallel invocation of make (-j). diff --git a/bindings/python-cffi/notmuch2/version.py b/bindings/python-cffi/notmuch2/version.py new file mode 100644 index 00000000..a5447027 --- /dev/null +++ b/bindings/python-cffi/notmuch2/version.py @@ -0,0 +1,3 @@ +# this file should be kept in sync with ../../../version +__VERSION__ = '0.30~rc2' +SOVERSION = '5' diff --git a/bindings/python-cffi/setup.py b/bindings/python-cffi/setup.py index 37918e3d..03649649 100644 --- a/bindings/python-cffi/setup.py +++ b/bindings/python-cffi/setup.py @@ -1,9 +1,16 @@ import setuptools +import os +# get the notmuch version number without importing the notmuch module +version_file = os.path.join(os.path.dirname(__file__), + 'notmuch2', 'version.py') +exec(compile(open(version_file).read(), version_file, 'exec')) +assert '__VERSION__' in globals(), \ + 'Failed to read the notmuch binding version number' 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@devork.be', diff --git a/bindings/python/setup.py b/bindings/python/setup.py index d986f0c6..d4c5c844 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -24,7 +24,7 @@ from distutils.core import setup # get the notmuch version number without importing the notmuch module version_file = os.path.join(os.path.dirname(__file__), - 'notmuch', 'version.py') + 'notmuch2', 'version.py') exec(compile(open(version_file).read(), version_file, 'exec')) assert '__VERSION__' in globals(), \ 'Failed to read the notmuch binding version number' -- 2.27.0
David Bremner <david@tethera.net> writes: > Copy machinery from the older python bindings > > +# get the notmuch version number without importing the notmuch module > +version_file = os.path.join(os.path.dirname(__file__), > + 'notmuch2', 'version.py') > +exec(compile(open(version_file).read(), version_file, 'exec')) > +assert '__VERSION__' in globals(), \ > + 'Failed to read the notmuch binding version number' I wrote a cover letter for this, but that seems to have gotten lost. My main point was I'm not sure why this is better than Floris's version, since they both read a file when setup.py is run. I don't understand (or use) pip, so someone else will have to figure this out. If the constraint is that the version has to be hardcoded in setup.py then (as much as that sounds like a design mistake), we can apply similar sed hackery directly to setup.py. Perhaps someone can remember why we didn't do that for the old python bindings. d
On Thu 25 Jun 2020 at 10:34 -0300, David Bremner wrote:
> David Bremner <david@tethera.net> writes:
>
>> Copy machinery from the older python bindings
>
>>
>> +# get the notmuch version number without importing the notmuch module
>> +version_file = os.path.join(os.path.dirname(__file__),
>> + 'notmuch2', 'version.py')
>> +exec(compile(open(version_file).read(), version_file, 'exec'))
>> +assert '__VERSION__' in globals(), \
>> + 'Failed to read the notmuch binding version number'
>
> I wrote a cover letter for this, but that seems to have gotten lost. My
> main point was I'm not sure why this is better than Floris's version,
> since they both read a file when setup.py is run. I don't understand (or
> use) pip, so someone else will have to figure this out. If the
> constraint is that the version has to be hardcoded in setup.py then (as
> much as that sounds like a design mistake), we can apply similar sed
> hackery directly to setup.py. Perhaps someone can remember why we didn't
> do that for the old python bindings.
For some reason this is the only mail in this thread I have, so I don't
actually know the patch.
I think it can be simpler though, is it possible to copy the toplevel
version file into bindings/python-cffi/version in the part of the build
that would otherwise do the sed magic? Then setup.py only needs to look
for the version file in the same directory as itself instead of finding
the toplevel of the repo.
Attempt to avoid breaking "pip install ." As far as I can tell, we need to have a copy (not just a relative symlink) of the version file. --- Makefile.local | 1 + bindings/python-cffi/setup.py | 8 +------- bindings/python-cffi/version | 1 + 3 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 bindings/python-cffi/version diff --git a/Makefile.local b/Makefile.local index 586cdf75..314238ef 100644 --- a/Makefile.local +++ b/Makefile.local @@ -54,6 +54,7 @@ update-versions: sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \ -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \ ${PV_FILE} + cp version bindings/python-cffi # We invoke make recursively only to force ordering of our phony # targets in the case of parallel invocation of make (-j). diff --git a/bindings/python-cffi/setup.py b/bindings/python-cffi/setup.py index 1effcfc6..b0060835 100644 --- a/bindings/python-cffi/setup.py +++ b/bindings/python-cffi/setup.py @@ -1,14 +1,8 @@ -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: +with open('version') as fp: VERSION = fp.read().strip() - setuptools.setup( name='notmuch2', version=VERSION, diff --git a/bindings/python-cffi/version b/bindings/python-cffi/version new file mode 100644 index 00000000..71971d9b --- /dev/null +++ b/bindings/python-cffi/version @@ -0,0 +1 @@ +0.30~rc2 -- 2.27.0
David Bremner <david@tethera.net> writes:
> Attempt to avoid breaking "pip install ."
>
> As far as I can tell, we need to have a copy (not just a relative
> symlink) of the version file.
Applied, as part of 0.30~rc3. Let me know if this is still broken for
pip users. I tried "pip install .", but that's all I know.
d
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org