[Distutils] Version numbers with a letter at the end
Phillip J. Eby
pje at telecommunity.com
Tue Nov 22 22:05:49 CET 2005
At 11:55 AM 11/22/2005 -0800, Ben Bangert wrote:
>Does setuptools distinguish and recognize letters in a version?
>
>For example, the latest Myghty is:
> version='0.99a'
>
>When I up it to '0.99a.1', and setuptools does a pre-requisite check,
>it doesn't seem to recognize that 0.99a.1 is more recent than 0.99a.
Really? I'm not able to reproduce this:
>>> from pkg_resources import parse_version as pv
>>> pv('0.99a.1') > pv('0.99a')
True
Are you sure those are the version numbers at issue?
>Also, this seems like it would cause problems with requirements that
>look for a dev version, as it'd be:
>"Myghty >= 0.99.adev-r1980"
If you have multiple pre-release tags like 'a' and 'dev', you should
separate them with a '.' - setuptools reads a contiguous run of letters as
a single pre- or post-release tag, so the above reads as the 'adev'
prerelease, not the 'dev' prerelease of the 'a' prerelease. Compare:
>>> pv("0.99.adev-r1980")
('00000000', '00000099', '*adev', '*final-', '*r', '00001980', '*final')
>>> pv("0.99.a.dev-r1980")
('00000000', '00000099', '*a', '*dev', '*final-', '*r', '00001980',
'*final')
Also, you don't need a dot to separate a numeric run from an alpha run,
although you can include it if you want:
>>> pv("0.99.a.dev-r1980")== pv("0.99a.dev-r1980")
True
Last week, I added a new documentation section to the setuptools.txt manual
explaining the versioning scheme in more detail, and including tips about
defining your pre- and post-release tagging schemes. See:
http://svn.python.org/projects/sandbox/trunk/setuptools/setuptools.txt
Under the heading "Specifying Your Project's Version", which is not far
from the top of the document.
More information about the Distutils-SIG
mailing list