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.
James Cameron
6 years ago
31 | 31 | (?P<version>\d+) # minimum 'N' |
32 | 32 | (?P<extraversion>(?:\.\d+)*) # any number of extra '.N' segments |
33 | 33 | (?: |
34 | (?P<local>\-[a-zA-Z]*) # ignore any string in the comparison | |
34 | (?P<local>[\-\~].[a-zA-Z]*) # ignore any string in the comparison | |
35 | 35 | )? |
36 | 36 | $''', re.VERBOSE) |
37 | 37 | |
44 | 44 | 1.2 |
45 | 45 | 1.2.3 |
46 | 46 | 1.2.3-peru |
47 | 1.2.3~dfsg | |
47 | 48 | |
48 | 49 | Bad: |
49 | 50 | 1.2peru # must be separated with - |