[Distutils] PEP440: foo-X.Y.Z does not satisfy "foo>X.Y"?

Marcus Smith qwcode at gmail.com
Sat Dec 27 08:13:48 CET 2014


> > the problem with thinking of it this way is that you naturally want to
> > extend the concept to >=, but it doesn't work.
> > If the concept were consistent,  1.7.dev1 would satisfy  >=1.7, but it
> > doesn't.
>
> I'm pretty sure it's consistent.  For example, "1.7.2" doesn't satisfy
> ">1.7", but it satisfies ">=1.7" (e.g. because it's "part of the
> series").
>
> I believe the inconsistency you're mentioning doesn't have anything to
> do with the comparison operator.  It's that pre-releases like "dev1"
> are special cases and governed by different rules. [...] are
> implicitly excluded


but look at this (using setuptools 8)

>>> '1.7.dev1' in pkg_resources.Requirement.parse('foo>=1.7')
False
>>> '1.7.dev1' in pkg_resources.Requirement.parse('foo<=1.7')
True

Only the exclusive ordering section speaks of the "!= V.*" bit.
The inclusive section just talks of zero padding and relative ordering.

The packaging implementation that underlies all this seems to bear this out
as well:

inclusive:
https://github.com/pypa/packaging/blob/master/packaging/specifiers.py#L453
exclusive:
https://github.com/pypa/packaging/blob/master/packaging/specifiers.py#L461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20141226/3158eba4/attachment-0001.html>


More information about the Distutils-SIG mailing list