From 4fb224232e150b4b49637673d6b00e46f884cf21 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Fri, 15 Oct 2021 13:14:12 +1100 Subject: [PATCH] chore: produce PEP440 compliant dev versions from RC tags --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 069af42..34efbc8 100644 --- a/setup.py +++ b/setup.py @@ -11,12 +11,12 @@ def get_current_version_tag(): tags = str(output, "utf-8").strip().split("\n") version_tags = [tag for tag in tags if re.match(r"^v?(\d*\.){2}\d$", tag)] - dev_tags = [tag for tag in tags if re.match(r"^v?(\d*\.){2}\d-\d*-[a-z\d]{8}$", tag)] + rc_tags = [tag for tag in tags if re.match(r"^v?(\d*\.){2}\d*-rc\.\d*$", tag)] if len(version_tags) == 1: return version_tags.pop()[1:] - elif len(dev_tags) == 1: - base_tag, num_commits = dev_tags.pop().split("-")[:2] + elif len(rc_tags) == 1: + base_tag, num_commits = rc_tags.pop().split("-rc.")[:2] return "{}.dev{}".format(base_tag, num_commits)[1:] else: return "0.0.0.dev0"