Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
_REGEX = re.compile(
r"""
^
(?P<major>(?:0|[1-9][0-9]*))
(?P<major>0|[1-9]\d*)
\.
(?P<minor>(?:0|[1-9][0-9]*))
(?P<minor>0|[1-9]\d*)
\.
(?P<patch>(?:0|[1-9][0-9]*))
(\-(?P<prerelease>
(?:0|[1-9A-Za-z-][0-9A-Za-z-]*)
(\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*
(?P<patch>0|[1-9]\d*)
(?:-(?P<prerelease>
(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)
(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*
))?
(\+(?P<build>
[0-9A-Za-z-]+
(\.[0-9A-Za-z-]+)*
(?:\+(?P<build>
[0-9a-zA-Z-]+
(?:\.[0-9a-zA-Z-]+)*
))?
$
""", re.VERBOSE)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run_tests(self):

class Clean(CleanCommand):
def run(self):
super().run()
super(CleanCommand, self).run()
delete_in_root = [
'build',
'.cache',
Expand Down
24 changes: 24 additions & 0 deletions test_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ def test_fordocstrings(func):
'prerelease': 'alpha-1',
'build': 'build.11.e0f985a',
}),
("0.1.0-0f",
{
'major': 0,
'minor': 1,
'patch': 0,
'prerelease': '0f',
'build': None,
}),
("0.0.0-0foo.1",
{
'major': 0,
'minor': 0,
'patch': 0,
'prerelease': '0foo.1',
'build': None,
}),
("0.0.0-0foo.1+build.1",
{
'major': 0,
'minor': 0,
'patch': 0,
'prerelease': '0foo.1',
'build': 'build.1',
}),
])
def test_should_parse_version(version, expected):
result = parse(version)
Expand Down