7 git_dir
= os
.path
.join(os
.path
.dirname(sys
.argv
[0]), '..', '.git')
9 git_sha1
= subprocess
.check_output([
11 '--git-dir=' + git_dir
,
15 ], stderr
=open(os
.devnull
, 'w'))
17 # don't print anything if it fails
20 sys
.stdout
.write('#define MESA_GIT_SHA1 "git-%s"\n' % git_sha1
.rstrip())