mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 11:11:47 +02:00
When kitty is built from a git checkout show the current revision in --debug-config
This commit is contained in:
10
kitty/cli.py
10
kitty/cli.py
@@ -245,8 +245,12 @@ def prettify(text):
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version(add_rev=False):
|
||||||
return '{} {} created by {}'.format(italic(appname), green(str_version), title('Kovid Goyal'))
|
rev = ''
|
||||||
|
from . import fast_data_types
|
||||||
|
if add_rev and hasattr(fast_data_types, 'KITTY_VCS_REV'):
|
||||||
|
rev = ' ({})'.format(fast_data_types.KITTY_VCS_REV[:10])
|
||||||
|
return '{} {}{} created by {}'.format(italic(appname), green(str_version), rev, title('Kovid Goyal'))
|
||||||
|
|
||||||
|
|
||||||
def wrap(text, limit=80):
|
def wrap(text, limit=80):
|
||||||
@@ -547,7 +551,7 @@ def compare_opts(opts):
|
|||||||
def create_opts(args, debug_config=False):
|
def create_opts(args, debug_config=False):
|
||||||
config = tuple(resolve_config(args.config))
|
config = tuple(resolve_config(args.config))
|
||||||
if debug_config:
|
if debug_config:
|
||||||
print(version())
|
print(version(add_rev=True))
|
||||||
print(' '.join(os.uname()))
|
print(' '.join(os.uname()))
|
||||||
if is_macos:
|
if is_macos:
|
||||||
print(' '.join(subprocess.check_output(['sw_vers']).decode('utf-8').splitlines()).strip())
|
print(' '.join(subprocess.check_output(['sw_vers']).decode('utf-8').splitlines()).strip())
|
||||||
|
|||||||
@@ -203,6 +203,9 @@ PyInit_fast_data_types(void) {
|
|||||||
PyModule_AddIntConstant(m, "STRIKETHROUGH", STRIKE_SHIFT);
|
PyModule_AddIntConstant(m, "STRIKETHROUGH", STRIKE_SHIFT);
|
||||||
PyModule_AddIntConstant(m, "DECORATION", DECORATION_SHIFT);
|
PyModule_AddIntConstant(m, "DECORATION", DECORATION_SHIFT);
|
||||||
PyModule_AddStringMacro(m, ERROR_PREFIX);
|
PyModule_AddStringMacro(m, ERROR_PREFIX);
|
||||||
|
#ifdef KITTY_VCS_REV
|
||||||
|
PyModule_AddStringMacro(m, KITTY_VCS_REV);
|
||||||
|
#endif
|
||||||
PyModule_AddIntMacro(m, CURSOR_BLOCK);
|
PyModule_AddIntMacro(m, CURSOR_BLOCK);
|
||||||
PyModule_AddIntMacro(m, CURSOR_BEAM);
|
PyModule_AddIntMacro(m, CURSOR_BEAM);
|
||||||
PyModule_AddIntMacro(m, CURSOR_UNDERLINE);
|
PyModule_AddIntMacro(m, CURSOR_UNDERLINE);
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -182,6 +182,10 @@ def init_env(
|
|||||||
cflags = shlex.split(cflags) + shlex.split(
|
cflags = shlex.split(cflags) + shlex.split(
|
||||||
sysconfig.get_config_var('CCSHARED')
|
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(
|
ldflags = os.environ.get(
|
||||||
'OVERRIDE_LDFLAGS',
|
'OVERRIDE_LDFLAGS',
|
||||||
'-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')
|
'-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')
|
||||||
|
|||||||
Reference in New Issue
Block a user