Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bindings/python/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

v<num>(.<num>)+ [ {a|b|c|rc} <num> (.<num>)* ]

Semver-style prerelease tags (v0.10.0-rc.1, the form Cargo
requires for the crate version) are also accepted, normalized
to the PEP 386 form (0.10.0rc1).

If “git describe” returns an error (likely because we're in an unpacked copy
of a release tarball, rather than a git working copy), or returns a tag that
does not match the above format, version is read from RELEASE-VERSION file.
Expand Down Expand Up @@ -74,6 +78,9 @@ def read_git_version():

if not ver:
return None
# Normalize a semver-style prerelease segment (-rc.1) to the PEP 386
# form (rc1) that _GIT_DESCRIPTION_RE parses.
ver = re.sub(r"(\d+(?:\.\d+)+)-(a|b|c|rc)\.?(\d+)", r"\1\2\3", ver)
match = re.search(_GIT_DESCRIPTION_RE, ver)
if not match:
sys.stderr.write("version: git description (%s) is invalid, ignoring\n" % ver)
Expand Down
Loading