Merge remote-tracking branch 'remotes/bignose-debian/wip/issue/strict-semver-parsing'
This commit is contained in:
commit
8533d37514
@ -21,6 +21,14 @@ Additions
|
|||||||
* Add ‘parse_version_info’ to parse a version string to a version info
|
* Add ‘parse_version_info’ to parse a version string to a version info
|
||||||
tuple.
|
tuple.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Refine parsing to conform more strictly to SemVer 2.0.0.
|
||||||
|
|
||||||
|
SemVer 2.0.0 specification §9 forbids leading zero on identifiers in
|
||||||
|
the prerelease version.
|
||||||
|
|
||||||
|
|
||||||
Version 2.6.0
|
Version 2.6.0
|
||||||
=============
|
=============
|
||||||
|
23
semver.py
23
semver.py
@ -10,11 +10,24 @@ __version__ = '2.6.0'
|
|||||||
__author__ = 'Konstantine Rybnikov'
|
__author__ = 'Konstantine Rybnikov'
|
||||||
__author_email__ = 'k-bx@k-bx.com'
|
__author_email__ = 'k-bx@k-bx.com'
|
||||||
|
|
||||||
_REGEX = re.compile('^(?P<major>(?:0|[1-9][0-9]*))'
|
_REGEX = re.compile(
|
||||||
'\.(?P<minor>(?:0|[1-9][0-9]*))'
|
r"""
|
||||||
'\.(?P<patch>(?:0|[1-9][0-9]*))'
|
^
|
||||||
'(\-(?P<prerelease>[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?'
|
(?P<major>(?:0|[1-9][0-9]*))
|
||||||
'(\+(?P<build>[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$')
|
\.
|
||||||
|
(?P<minor>(?:0|[1-9][0-9]*))
|
||||||
|
\.
|
||||||
|
(?P<patch>(?:0|[1-9][0-9]*))
|
||||||
|
(\-(?P<prerelease>
|
||||||
|
[1-9A-Za-z-][0-9A-Za-z-]*
|
||||||
|
(\.[1-9A-Za-z-][0-9A-Za-z-]*)*
|
||||||
|
))?
|
||||||
|
(\+(?P<build>
|
||||||
|
[0-9A-Za-z-]+
|
||||||
|
(\.[0-9A-Za-z-]+)*
|
||||||
|
))?
|
||||||
|
$
|
||||||
|
""", re.VERBOSE)
|
||||||
|
|
||||||
_LAST_NUMBER = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
|
_LAST_NUMBER = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user