setup.py: produce PEP440 compatible version when repositoty is dirty

This commit is contained in:
Benjamin Dauvergne 2023-04-07 10:36:48 +02:00
parent 7199504489
commit cf8a95af50
1 changed files with 2 additions and 0 deletions

View File

@ -98,6 +98,8 @@ def get_version():
if '-' in result: # not a tagged version
real_number, commit_count, commit_hash = result.split('-', 2)
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
elif result.endswith('.dirty'):
version = result[:-6] + '+dirty'
else:
version = result
return version