Skip to content

Commit 17e1b92

Browse files
sjmonsonmarkurtz
authored andcommitted
Assume tags are releases in dev versioning
Signed-off-by: Samuel Monson <smonson@redhat.com>
1 parent 365be73 commit 17e1b92

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

setup.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup
77
from setuptools_git_versioning import count_since, get_branch, get_sha, get_tags
88

9-
LAST_RELEASE_VERSION = Version("0.3.0")
9+
LAST_RELEASE_VERSION = Version("0.4.0")
1010
TAG_VERSION_PATTERN = re.compile(r"^v(\d+\.\d+\.\d+)$")
1111

1212

@@ -67,17 +67,19 @@ def get_next_version(
6767
return version, tag, build_iteration
6868

6969
# not in release pathway, so need to increment to target next release version
70-
version = Version(f"{version.major}.{version.minor + 1}.0")
70+
version_next = Version(f"{version.major}.{version.minor + 1}.0")
7171

7272
if build_type == "candidate":
7373
# add 'rc' since we are in candidate pathway
74-
version = Version(f"{version}.rc{build_iteration}")
74+
version = Version(f"{version_next}.rc{build_iteration}")
7575
elif build_type in ["nightly", "alpha"]:
7676
# add 'a' since we are in nightly or alpha pathway
77-
version = Version(f"{version}.a{build_iteration}")
78-
else:
79-
# assume 'dev' if not in any of the above pathways
80-
version = Version(f"{version}.dev{build_iteration}")
77+
version = Version(f"{version_next}.a{build_iteration}")
78+
# assume 'dev' if not in any of the above pathways
79+
# None indicates git failed to find last tag
80+
# 0 indicates no new commits since last tag
81+
elif commits_since_last != 0:
82+
version = Version(f"{version_next}.dev{build_iteration}")
8183

8284
return version, tag, build_iteration
8385

0 commit comments

Comments
 (0)