summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2020-03-25 14:58:26 +0000
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2020-03-25 14:58:26 +0000
commit7ca148ad7bb7813d01a88f9f6c5fd1461157040b (patch)
treec13616c98cca109c9dbcebc6e5fb598a304d2a54
parentad80a3dd2174671d49ef4dd3b431f381d6b0219c (diff)
downloadsetuptools-scm-7ca148ad7bb7813d01a88f9f6c5fd1461157040b.tar.gz
Select git tags based on presence of numbers, rather than dots.
The default `git describe` command had an undocumented `--match *.*` in it, intended to skip over tags that may represent human-readable checkpoints. Unfortunately this means it would be ignoring single-component versions. Instead look for presence of digits in the tag, it's still a heuristic, but it should cover all previous cases, and fix single component versions.
-rw-r--r--src/setuptools_scm/git.py2
-rw-r--r--testing/test_git.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py
index afefa34..76be436 100644
--- a/src/setuptools_scm/git.py
+++ b/src/setuptools_scm/git.py
@@ -12,7 +12,7 @@ except ImportError:
from .win_py31_compat import samefile
-DEFAULT_DESCRIBE = "git describe --dirty --tags --long --match *.*"
+DEFAULT_DESCRIBE = "git describe --dirty --tags --long --match *[0-9]*"
class GitWorkdir(object):
diff --git a/testing/test_git.py b/testing/test_git.py
index 337efdd..8416571 100644
--- a/testing/test_git.py
+++ b/testing/test_git.py
@@ -233,6 +233,14 @@ def test_not_matching_tags(wd):
).startswith("0.11.2")
+@pytest.mark.issue("https://github.com/pypa/setuptools_scm/issues/411")
+def test_non_dotted_version(wd):
+ wd.commit_testfile()
+ wd("git tag apache-arrow-1")
+ wd.commit_testfile()
+ assert wd.get_version().startswith("2")
+
+
@pytest.mark.issue("https://github.com/pypa/setuptools_scm/issues/381")
def test_gitdir(monkeypatch, wd):
"""