When kitty is built from a git checkout show the current revision in --debug-config

This commit is contained in:
Kovid Goyal
2018-04-01 20:27:31 +05:30
parent 325d2bc14e
commit fa064bf9cf
3 changed files with 14 additions and 3 deletions

View File

@@ -182,6 +182,10 @@ def init_env(
cflags = shlex.split(cflags) + shlex.split(
sysconfig.get_config_var('CCSHARED')
)
if os.path.exists('.git'):
head = open('.git/HEAD', 'r').read().split(':', 1)[-1].strip()
rev = open('.git/' + head).read().split(':', 1)[-1].strip()
cflags.append('-DKITTY_VCS_REV="{}"'.format(rev))
ldflags = os.environ.get(
'OVERRIDE_LDFLAGS',
'-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')