Properly decode git information before printing it into version.h

This commit is contained in:
DrChat 2017-12-15 23:43:27 -06:00
parent 66d19a462b
commit 3d1a1c2519
1 changed files with 3 additions and 3 deletions

View File

@ -215,14 +215,14 @@ def get_git_head_info():
'HEAD', 'HEAD',
], stdout=subprocess.PIPE, stderr=subprocess.PIPE) ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
branch_name = stdout.strip() or 'detached' branch_name = stdout.decode('ascii').strip() or 'detached'
p = subprocess.Popen([ p = subprocess.Popen([
'git', 'git',
'rev-parse', 'rev-parse',
'HEAD', 'HEAD',
], stdout=subprocess.PIPE, stderr=subprocess.PIPE) ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
commit = stdout.strip() or 'unknown' commit = stdout.decode('ascii').strip() or 'unknown'
p = subprocess.Popen([ p = subprocess.Popen([
'git', 'git',
'rev-parse', 'rev-parse',
@ -230,7 +230,7 @@ def get_git_head_info():
'HEAD', 'HEAD',
], stdout=subprocess.PIPE, stderr=subprocess.PIPE) ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
commit_short = stdout.strip() or 'unknown' commit_short = stdout.decode('ascii').strip() or 'unknown'
return branch_name, commit, commit_short return branch_name, commit, commit_short