Skip to content

Commit

Permalink
Merge pull request #1623 from matthewfeickert/fix/sanitize-rc-version…
Browse files Browse the repository at this point in the history
…-names

[pip] Sanitize release candidate versions to PEP 440
  • Loading branch information
simonmichal authored Feb 21, 2022
2 parents 2741fe4 + c6d9100 commit 3b34050
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bindings/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ if version.startswith("v"):
version = version[1:]

version_parts = version.split(".")

# Ensure release candidates sanitized to <major>.<minor>.<patch>rc<candidate>
if version_parts[-1].startswith("rc"):
version = ".".join(version_parts[:-1]) + version_parts[-1]
version_parts = version.split(".")

if len(version_parts[0]) == 8:
# CalVer
date = version_parts[0]
Expand Down
5 changes: 5 additions & 0 deletions packaging/wheel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def get_version():

version_parts = version.split(".")

# Ensure release candidates sanitized to <major>.<minor>.<patch>rc<candidate>
if version_parts[-1].startswith("rc"):
version = ".".join(version_parts[:-1]) + version_parts[-1]
version_parts = version.split(".")

# Assume SemVer as default case
if len(version_parts[0]) == 8:
# CalVer
Expand Down

0 comments on commit 3b34050

Please sign in to comment.