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

Floris Bruynooghe flub at devork.be
Fri Jun 19 03:50:45 PDT 2020


On Fri 19 Jun 2020 at 07:20 -0300, David Bremner wrote:

> Floris Bruynooghe <flub at devork.be> writes:
> BTW I noticed something (setuptools?) translates "0.30~rc2" to
> "0.30-rc2". I assume that is as intended, and there are some stricter
> rules for python module versions. It should only affect pre-release
> versions in any case.

Supposedly setuptools uses packaging.version:

   $ python3
   Python 3.8.3 (default, May 14 2020, 11:03:12)
   [GCC 9.3.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import packaging.version
   >>> rc1 = packaging.version.parse('0.30~rc1')
   >>> rc1
   <LegacyVersion('0.30~rc1')>
   >>> rc2 = packaging.version.parse('0.30~rc2')
   >>> maj = packaging.version.parse('0.30')
   >>> maj
   <Version('0.30')>
   >>> rc1 < rc2 < maj
   True

So I think this is ok?  Just for completeness:

   >>> rc1b = packaging.version.parse('0.30-rc1')
   >>> rc1b
   <Version('0.30rc1')>
   >>> rc1b < maj
   True

Apparently PEP440 has the full details of how Python wants to see
version numbers work, but it's too many years ago that I read that
thing ;).  This seems good enough to me.

Cheers,
Floris


More information about the notmuch mailing list