Skip to content

Commit

Permalink
chore: produce PEP440 compliant dev versions from RC tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jyecusch committed Oct 15, 2021
1 parent 6305ebe commit 4fb2242
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4fb2242

Please sign in to comment.