Skip to content

Commit

Permalink
build: always use three-component version numbers
Browse files Browse the repository at this point in the history
Someone thought we didn't use semantic versioning because we said "6.4" instead
of "6.4.0".  Don't trim .0.
  • Loading branch information
nedbat committed May 30, 2022
1 parent 3a83e41 commit f9a74c7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Unreleased
.. _pull 1381: https://github.com/nedbat/coveragepy/pull/1381



.. _changes_64:

Version 6.4 — 2022-05-22
Expand Down
4 changes: 1 addition & 3 deletions coverage/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
def _make_version(major, minor, micro, releaselevel, serial):
"""Create a readable version string from version_info tuple components."""
assert releaselevel in ['alpha', 'beta', 'candidate', 'final']
version = "%d.%d" % (major, minor)
if micro:
version += ".%d" % (micro,)
version = "%d.%d.%d" % (major, minor, micro)
if releaselevel != 'final':
short = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc'}[releaselevel]
version += f"{short}{serial}"
Expand Down
7 changes: 2 additions & 5 deletions igor.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,9 @@ def do_cheats():
import coverage
ver = coverage.__version__
vi = coverage.version_info
anchor = f"{vi[0]}{vi[1]}"
if vi[2]:
anchor += f"{vi[2]}"
anchor = f"{vi[0]}-{vi[1]}-{vi[2]}"
if vi[3] != "final":
anchor += vi[3][0]
anchor += f"{vi[4]}"
anchor += f"{vi[3][0]}{vi[4]}"
branch = subprocess.getoutput("git rev-parse --abbrev-ref @")
print(f"Coverage version is {ver}")

Expand Down
7 changes: 4 additions & 3 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def test_version_info(self):
assert coverage.version_info[3] in ['alpha', 'beta', 'candidate', 'final']

def test_make_version(self):
assert _make_version(4, 0, 0, 'alpha', 0) == "4.0a0"
assert _make_version(4, 0, 0, 'alpha', 1) == "4.0a1"
assert _make_version(4, 0, 0, 'final', 0) == "4.0"
assert _make_version(4, 0, 0, 'alpha', 0) == "4.0.0a0"
assert _make_version(4, 0, 0, 'alpha', 1) == "4.0.0a1"
assert _make_version(4, 0, 0, 'final', 0) == "4.0.0"
assert _make_version(4, 1, 0, 'final', 0) == "4.1.0"
assert _make_version(4, 1, 2, 'beta', 3) == "4.1.2b3"
assert _make_version(4, 1, 2, 'final', 0) == "4.1.2"
assert _make_version(5, 10, 2, 'candidate', 7) == "5.10.2rc7"
Expand Down

0 comments on commit f9a74c7

Please sign in to comment.