From c49e7ce76d90f2899366968f2ec0b4b2bea0f14f Mon Sep 17 00:00:00 2001 From: Jeremy Cohen Date: Fri, 22 Jul 2022 16:28:18 +0200 Subject: [PATCH] Make hyphen optional for prerelease suffix --- hubcap/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hubcap/version.py b/hubcap/version.py index e442555..02513ce 100644 --- a/hubcap/version.py +++ b/hubcap/version.py @@ -12,7 +12,7 @@ def parse_semver_tag(tag): '''use regexes to parse the semver tag into groups''' # regex taken from official SEMVER documentation site - match = re.match('^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?: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[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', + match = re.match('^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-?(?P(?: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[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', tag[1:] if tag.startswith('v') else tag ) return match