setup.py: does not build the distribution tarball if git workdir is not clean
This commit is contained in:
parent
cffad1de38
commit
5389975c0a
3
setup.py
3
setup.py
|
@ -64,11 +64,12 @@ def get_version():
|
|||
assert version is not None
|
||||
if os.path.exists('.git'):
|
||||
import subprocess
|
||||
p = subprocess.Popen(['git','describe'],
|
||||
p = subprocess.Popen(['git','describe','--dirty'],
|
||||
stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
assert p.returncode == 0, 'git returned non-zero'
|
||||
new_version = result.split()[0]
|
||||
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('-', '.')
|
||||
return version
|
||||
|
|
Reference in New Issue