setup.py: only use tag matching v* for building the version string
This commit is contained in:
parent
5389975c0a
commit
fe3a77c488
4
setup.py
4
setup.py
|
@ -64,11 +64,11 @@ def get_version():
|
|||
assert version is not None
|
||||
if os.path.exists('.git'):
|
||||
import subprocess
|
||||
p = subprocess.Popen(['git','describe','--dirty'],
|
||||
p = subprocess.Popen(['git','describe','--dirty','--match=v*'],
|
||||
stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
assert p.returncode == 0, 'git returned non-zero'
|
||||
new_version = result.split()[0]
|
||||
new_version = result.split()[0][1:]
|
||||
assert not new_version.endswith('-dirty'), 'git workdir is not clean'
|
||||
assert new_version.split('-')[0] == version, '__version__ must match the last git annotated tag'
|
||||
version = new_version.replace('-', '.')
|
||||
|
|
Reference in New Issue