Skip to content

Fix #194 and #114: Update semver regex to version from semver.org #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2019
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy