2017-08-01 14:36:16 +01:00
|
|
|
#!/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',
|
2017-08-02 15:01:21 +01:00
|
|
|
], stderr=open(os.devnull, 'w')).decode("ascii")
|
2017-08-02 14:57:52 +01:00
|
|
|
except:
|
|
|
|
# don't print anything if it fails
|
2017-08-02 02:05:42 +01:00
|
|
|
pass
|
2017-08-01 14:36:16 +01:00
|
|
|
else:
|
|
|
|
sys.stdout.write('#define MESA_GIT_SHA1 "git-%s"\n' % git_sha1.rstrip())
|