NormalizedVersion - accept ~ as version separator

Bundle versions are often described as being decimal floats e.g. 1.2,
but they also accept more than one dot, and a suffix after a dash,
e.g. 1.2.3-peru

Debian project and Ubuntu often use ~ for modified sources to comply
with distribution policy (~dfsg), or developer builds.

The dist_source target for setup.py does not work with
a version suffix like ~dfsg, requiring a manual step to rename the
file.

Adjust the regular expression to accept the ~ form.
master
James Cameron 7 years ago
parent 2f3c47ffb0
commit 002349f290

@ -32,7 +32,7 @@ VERSION_RE = re.compile(r'''
(?P<version>\d+) # minimum 'N'
(?P<extraversion>(?:\.\d+)*) # any number of extra '.N' segments
(?:
(?P<local>\-[a-zA-Z]*) # ignore any string in the comparison
(?P<local>[\-\~].[a-zA-Z]*) # ignore any string in the comparison
)?
$''', re.VERBOSE)
@ -45,6 +45,7 @@ class NormalizedVersion(object):
1.2
1.2.3
1.2.3-peru
1.2.3~dfsg
Bad:
1.2peru # must be separated with -

Loading…
Cancel
Save