Skip to content

Commit

Permalink
Merge pull request #48 from nitrictech/fix/rc-release-versioning
Browse files Browse the repository at this point in the history
chore: produce PEP440 compliant dev versions from RC tags
  • Loading branch information
tjholm authored Oct 15, 2021
2 parents 6305ebe + 4fb2242 commit 0b00b91
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 0b00b91

Please sign in to comment.