diff --git a/build-terminfo b/build-terminfo index 52ef86cd9..25bbc50bc 100755 --- a/build-terminfo +++ b/build-terminfo @@ -11,7 +11,7 @@ import sys import tempfile -def compile_terminfo(base, add_other_versions=False): +def compile_terminfo(base): with tempfile.TemporaryDirectory() as tdir: proc = subprocess.run(['tic', '-x', f'-o{tdir}', 'terminfo/kitty.terminfo'], check=True, stderr=subprocess.PIPE) regex = '^"terminfo/kitty.terminfo", line [0-9]+, col [0-9]+, terminal \'xterm-kitty\': older tic versions may treat the description field as an alias$' @@ -29,13 +29,6 @@ def compile_terminfo(base, add_other_versions=False): os.makedirs(odir, exist_ok=True) ofile = os.path.join(odir, xterm_kitty) shutil.move(tfile, ofile) - if add_other_versions: - shutil.copy2('terminfo/kitty.terminfo', base) - for x in os.listdir('terminfo'): - if x == 'kitty.terminfo': - continue - if not os.path.exists(os.path.join(base, x)): - os.symlink(directory, os.path.join(base, x)) def generate_terminfo(): diff --git a/kittens/ssh/main.py b/kittens/ssh/main.py index 2377e7335..dc6f89cef 100644 --- a/kittens/ssh/main.py +++ b/kittens/ssh/main.py @@ -3,6 +3,7 @@ import atexit import fnmatch +import glob import io import json import os @@ -131,7 +132,8 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str], compression: st f'{arcname}/ssh/*', # bootstrap files are sent as command line args f'{arcname}/zsh/kitty.zsh', # present for legacy compat not needed by ssh kitten )) - tf.add(terminfo_dir, arcname='home/.terminfo', filter=normalize_tarinfo) + tf.add(f'{terminfo_dir}/kitty.terminfo', arcname='home/.terminfo/kitty.terminfo', filter=normalize_tarinfo) + tf.add(glob.glob(f'{terminfo_dir}/*/xterm-kitty')[0], arcname='home/.terminfo/x/xterm-kitty', filter=normalize_tarinfo) return buf.getvalue() diff --git a/setup.py b/setup.py index ca49e7c11..45c31fb52 100755 --- a/setup.py +++ b/setup.py @@ -1258,7 +1258,7 @@ def package(args: Options, bundle_type: str) -> None: for x in (libdir, os.path.join(ddir, 'share')): odir = os.path.join(x, 'terminfo') safe_makedirs(odir) - build_terminfo['compile_terminfo'](odir, add_other_versions=True) + build_terminfo['compile_terminfo'](odir) shutil.copy2('__main__.py', libdir) shutil.copy2('logo/kitty-128.png', os.path.join(libdir, 'logo')) shutil.copy2('logo/kitty.png', os.path.join(libdir, 'logo')) diff --git a/shell-integration/ssh/bootstrap.py b/shell-integration/ssh/bootstrap.py index 50f5800f3..cb33dbbd8 100644 --- a/shell-integration/ssh/bootstrap.py +++ b/shell-integration/ssh/bootstrap.py @@ -121,6 +121,10 @@ def compile_terminfo(base): if cp.returncode != 0: sys.stderr.buffer.write(cp.stdout) raise SystemExit('Failed to compile the terminfo database') + q = os.path.join(base, tname, '78', 'xterm-kitty') + if not os.path.exists(q): + os.makedirs(os.path.dirname(q), exist_ok=True) + os.symlink("../x/xterm-kitty", q) def get_data(): diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index 341cc3724..67de4b93f 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -201,6 +201,12 @@ compile_terminfo() { tic_out=$(command tic -x -o "$1/$tname" "$1/.terminfo/kitty.terminfo" 2>&1) [ $? = 0 ] || die "Failed to compile terminfo with err: $tic_out"; fi + + # Ensure the 78 dir is present + if [ ! -f "$1/$tname/78/xterm-kitty" ]; then + command mkdir -p "$1/$tname/78" + command ln -sf "../x/xterm-kitty" "$1/$tname/78/xterm-kitty" + fi } untar_and_read_env() {