Skip to content

Commit a3bc80d

Browse files
Merge pull request #163 from RonnyPfannschmidt/fix-150
strip local components off tags, fixes #150
2 parents 10d75f6 + 29fc011 commit a3bc80d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ v1.15.3
22
=======
33

44
* bring back correctly getting our version in the own sdist, finalizes #114
5-
5+
* fix issue #150: strip local components of tags
66

77
v1.15.2
88
=======

setuptools_scm/version.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import print_function
22
import datetime
3+
import warnings
34
import re
45
from .utils import trace
56

@@ -31,8 +32,12 @@ def callable_or_entrypoint(group, callable_or_name):
3132

3233
def tag_to_version(tag):
3334
trace('tag', tag)
35+
if '+' in tag:
36+
warnings.warn("tag %r will be stripped of the local component" % tag)
37+
tag = tag.split('+')[0]
3438
# lstrip the v because of py2/py3 differences in setuptools
3539
# also required for old versions of setuptools
40+
3641
version = tag.rsplit('-', 1)[-1].lstrip('v')
3742
if parse_version is None:
3843
return version

testing/test_git.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def test_version_from_git(wd):
3434
wd('git tag version-0.2')
3535
assert wd.version.startswith('0.2')
3636

37+
wd.commit_testfile()
38+
wd('git tag version-0.2.post210+gbe48adfpost3+g0cc25f2')
39+
assert wd.version.startswith('0.2')
40+
3741

3842
@pytest.mark.issue(108)
3943
@pytest.mark.issue(109)

0 commit comments

Comments
 (0)