setup.py: only use tag matching v* for building the version string

This commit is contained in:
Benjamin Dauvergne 2013-05-15 15:24:53 +02:00
parent 5389975c0a
commit fe3a77c488
1 changed files with 2 additions and 2 deletions

View File

@ -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('-', '.')