3333def gitinfo():
3434 from subprocess import Popen, PIPE, check_output
3535 kw = dict(stdout=PIPE, cwd=MYDIR, universal_newlines=True)
36- proc = Popen(['git', 'describe', '--tags', '--match=v[ [:digit:]]*'], **kw)
36+ proc = Popen(['git', 'describe', '--tags', '--match=[v,V, [:digit:]]*'], **kw)
3737 desc = proc.stdout.read()
3838 proc = Popen(['git', 'log', '-1', '--format=%H %ct %ci'], **kw)
3939 glog = proc.stdout.read()
4040 rv = {}
4141 rv['commit'], rv['timestamp'], rv['date'] = glog.strip().split(None, 2)
42- version = check_output(['git', 'tag']).decode('ascii').strip( )
42+ version = '.post'.join(desc.strip().split('-')[:2]).lstrip('vV' )
4343 rv['version'] = version
4444 return rv
4545
@@ -56,7 +56,7 @@ def getversioncfg():
5656 cp0.read(gitarchivecfgfile)
5757 if len(cp0.get('DEFAULT', 'commit')) > 20:
5858 g = cp0.defaults()
59- mx = re.search(r'\btag: v (\d[^,]*)', g.pop('refnames'))
59+ mx = re.search(r'\btag: [vV]? (\d[^,]*)', g.pop('refnames'))
6060 if mx:
6161 g['version'] = mx.group(1)
6262 # then try to obtain version data from git.
0 commit comments