
String handling has changed on python3.
Before this patch, on python3:
#define MESA_GIT_SHA1 "git-b'b99dcbfeb3'"
After:
#define MESA_GIT_SHA1 "git-b99dcbfeb3"
(No change on python2, it always looked ok)
Cc: Jose Fonseca <jfonseca@vmware.com>
Fixes: b99dcbfeb3
"build: Convert git_sha1_gen script to Python."
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
21 lines
479 B
Python
Executable File
21 lines
479 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os.path
|
|
import subprocess
|
|
import sys
|
|
|
|
git_dir = os.path.join(os.path.dirname(sys.argv[0]), '..', '.git')
|
|
try:
|
|
git_sha1 = subprocess.check_output([
|
|
'git',
|
|
'--git-dir=' + git_dir,
|
|
'rev-parse',
|
|
'--short=10',
|
|
'HEAD',
|
|
], stderr=open(os.devnull, 'w')).decode("ascii")
|
|
except:
|
|
# don't print anything if it fails
|
|
pass
|
|
else:
|
|
sys.stdout.write('#define MESA_GIT_SHA1 "git-%s"\n' % git_sha1.rstrip())
|