diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2015-12-07 18:45:46 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2015-12-07 18:45:46 +0100 |
commit | d80fde972239b83fd9d56ac2318e8fa37069bb9b (patch) | |
tree | 52655ae6755119d434d512f50e85d5b3a4f67327 | |
parent | c6f4ee6124cf9f8123c852522b28a2299b3d35f7 (diff) | |
download | setuptools-scm-d80fde972239b83fd9d56ac2318e8fa37069bb9b.tar.gz |
coding and documentation style cleanups
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | setuptools_scm/git.py | 9 | ||||
-rw-r--r-- | testing/test_basic_api.py | 2 |
3 files changed, 8 insertions, 6 deletions
@@ -147,7 +147,8 @@ The Currently supported configuration keys are: a function that will be used instead of the discovered scm for parsing the version, use with caution, this is a expert function and you should be closely familiar with the setuptools_scm internals to use it - + + .. versionadded:: 1.10 To use setuptools_scm in other Python code you can use the ``get_version`` function: diff --git a/setuptools_scm/git.py b/setuptools_scm/git.py index 76cc996..40b0f77 100644 --- a/setuptools_scm/git.py +++ b/setuptools_scm/git.py @@ -4,10 +4,13 @@ from os.path import abspath, realpath FILES_COMMAND = 'git ls-files' +DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*' -def parse(root, match_tags=r'*.*'): +def parse(root, describe_command=DEFAULT_DESCRIBE): real_root, _, ret = do_ex('git rev-parse --show-toplevel', root) + if ret: + return trace('real root', real_root) if abspath(realpath(real_root)) != abspath(realpath(root)): return @@ -15,9 +18,7 @@ def parse(root, match_tags=r'*.*'): if ret: return meta('0.0') rev_node = rev_node[:7] - out, err, ret = do_ex( - 'git describe --dirty --tags --long --match %r' % match_tags, - root) + out, err, ret = do_ex(describe_command, root) if '-' not in out and '.' not in out: revs = do('git rev-list HEAD', root) count = revs.count('\n') diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py index 5a8eeca..55a7ea4 100644 --- a/testing/test_basic_api.py +++ b/testing/test_basic_api.py @@ -74,7 +74,7 @@ def test_dump_version(tmpdir): ast.parse(content) -def test_parse(): +def test_parse_plain(): def parse(root): return 'tricked you' assert setuptools_scm.get_version(parse=parse) == 'tricked you' |