blob: e8aca2b7b1bdff198e14a5b0d614fa71acf580b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import re
import subprocess
VERSION = None
def _get_version():
'''return either the tag on HEAD or the shortened commit id if not found'''
out = subprocess.check_output(['git', 'log', '--format=%h %d', '-1'])
version, ref_names = out.split('(')
m = re.match(r'.*tag: (\d{4}\.\d{2}.*?),', ref_names)
if m:
version = m.group(1)
return version.strip()
try:
VERSION = _get_version()
except:
VERSION = '???'
|