[Distutils] PEP 386 status - last round here ?
M.-A. Lemburg
mal at egenix.com
Sat Nov 28 20:11:20 CET 2009
Tarek Ziadé wrote:
> On Thu, Nov 26, 2009 at 1:08 PM, M.-A. Lemburg <mal at egenix.com> wrote:
>> Here's another take at a minimal change to the format which
>> includes the things we discussed, adds a few more aliases
>> for the "post" and "dev" markers and also adds optional
>> underscores for more readability.
>>
>> VERSION_RE = re.compile(r'''
>> ^
>> (?P<version>\d+\.\d+) # minimum 'N.N'
>> (?P<extraversion>(?:\.\d+)*) # any number of extra '.N' segments
>> (?: # pre-release tag
>> _?
>> (?P<prerel>(a|alpha|b|beta|c|rc))
>> _?
>> (?P<prerelversion>\d+(?:\.\d+)*)
>> )?
>> (?P<postdev>
>> (\.(post|fix|sp)_?(?P<post>\d+))?
>> (\.(dev|pre|build|nightly)_?(?P<dev>\d+))?
>> )?
>> $''', re.VERBOSE + re.I)
>>
>> Examples:
>>
>> 3.2.0a0.20091125
>> < 3.2.0a1
>> = 3.2.0_alpha_1
>> < 3.2.0a1.20091125
>> < 3.2.0rc1
>> = 3.2.0c1
>> < 3.2.0rc1.20091125
>> = 3.2.0_rc1.20091125
>> < 3.2.0
>> < 3.2.0.sp1
>> = 3.2.0.fix1
>> = 3.2.0.post1
>>
>> One nit I have with the order of the N.N.devN version is that it is regarded
>> "more" than any of the pre-release tags, but less than the release itself:
>>
>> 1.0a1
>> < 1.0rc1
>> < 1.0.dev456
>> < 1.0
>>
>> IMHO, the order should be:
>>
>> 1.0.dev456
>> < 1.0a1.dev456
>> < 1.0a1
>> < 1.0rc1.dev456
>> < 1.0rc1
>> < 1.0
>>
>> since the .dev versions are really only snapshots leading up to
>> some release, i.e. 1.0.dev456 is a snapshot leading up to the
>> first pre-release of the 1.0 :-)
>
> That's right, that's a bug in the PEP and/or verlib.py
>
> The changes look good to me.
>
> If you made some changes in verlib, would you mind pushing them back at
>
> http://bitbucket.org/tarek/distutilsversion ?
I haven't made any changes to verlib, only to the RE.
Here's the test for it:
import re
VERSION_RE = re.compile(r'''
^
(?P<version>\d+\.\d+) # minimum 'N.N'
(?P<extraversion>(?:\.\d+)*) # any number of extra '.N' segments
(?: # pre-release tag
_?
(?P<prerel>(a|alpha|b|beta|c|rc))
_?
(?P<prerelversion>\d+(?:\.\d+)*)
)?
(?P<postdev>
(\.(post|fix|sp)_?(?P<post>\d+))?
(\.(dev|pre|build|nightly)_?(?P<dev>\d+))?
)?
$''', re.VERBOSE + re.I)
test = """\
3.2.0a0.20091125
< 3.2.0a1
= 3.2.0_alpha_1
< 3.2.0a1.20091125
< 3.2.0rc1
= 3.2.0c1
< 3.2.0rc1.20091125
= 3.2.0_rc1.20091125
< 3.2.0
< 3.2.0.sp1
= 3.2.0.fix1
= 3.2.0.post1
"""
testcases = [x.strip() for x in test.split()]
comp = None
version = None
for x in testcases:
if x in '<=':
continue
assert VERSION_RE.match(x), x
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Nov 28 2009)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
More information about the Distutils-SIG
mailing list