diff options
author | Luciano Bello <luciano@debian.org> | 2018-10-27 16:11:55 -0400 |
---|---|---|
committer | Luciano Bello <luciano.bello@ibm.com> | 2018-10-28 14:14:58 -0400 |
commit | f79598b7acc17b8d6c05d7a9fec502f41b7e8be5 (patch) | |
tree | 6221cacbca3b3f6916f314c190000bf1ad15b188 /src | |
parent | b72e86857802b257cc72d420c706624daf5f97ec (diff) | |
download | setuptools-scm-f79598b7acc17b8d6c05d7a9fec502f41b7e8be5.tar.gz |
Add option git_describe_command
The option git_describe_command is added to allow the user to manipulate how `git describe` is called.
Fixes #303
Fixes #283
Diffstat (limited to 'src')
-rw-r--r-- | src/setuptools_scm/__init__.py | 2 | ||||
-rw-r--r-- | src/setuptools_scm/config.py | 1 | ||||
-rw-r--r-- | src/setuptools_scm/git.py | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/setuptools_scm/__init__.py b/src/setuptools_scm/__init__.py index 1a39ac0..f49cce4 100644 --- a/src/setuptools_scm/__init__.py +++ b/src/setuptools_scm/__init__.py @@ -121,6 +121,7 @@ def get_version( relative_to=None, tag_regex=None, parse=None, + git_describe_command=None, ): """ If supplied, relative_to should be a file from which root may @@ -138,6 +139,7 @@ def get_version( config.relative_to = relative_to config.tag_regex = tag_regex config.parse = parse + config.git_describe_command = git_describe_command parsed_version = _do_parse(config) diff --git a/src/setuptools_scm/config.py b/src/setuptools_scm/config.py index f62f467..796dd0b 100644 --- a/src/setuptools_scm/config.py +++ b/src/setuptools_scm/config.py @@ -61,6 +61,7 @@ class Configuration(object): self.write_to_template = None self.parse = None self.tag_regex = DEFAULT_TAG_REGEX + self.git_describe_command = None @property def absolute_root(self): diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index 8a91ff3..91644c7 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -101,9 +101,12 @@ def parse( if pre_parse: pre_parse(wd) + if config.git_describe_command: + describe_command = config.git_describe_command + out, unused_err, ret = wd.do_ex(describe_command) if ret: - # If 'git describe' failed, try to get the information otherwise. + # If 'git git_describe_command' failed, try to get the information otherwise. rev_node = wd.node() dirty = wd.is_dirty() |