tag_to_version.py: fix Python3 error (#7056)

subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.
This commit is contained in:
Julian Oes 2017-04-16 16:03:06 +02:00 committed by Daniel Agar
parent 4487f06629
commit 0d2e847c57
1 changed files with 2 additions and 0 deletions

View File

@ -12,6 +12,8 @@ p= subprocess.Popen(
'git describe --always --tags'.split(), 'git describe --always --tags'.split(),
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
# Python3 needs this decode step.
stdout = stdout.decode('ascii')
res = stdout.split('-')[0].split('.') res = stdout.split('-')[0].split('.')
major = res[0].replace('v','') major = res[0].replace('v','')
minor = res[1] minor = res[1]