Include all terminfo variants in binary bundles

Needed so that they can be transmitted over ssh easily
This commit is contained in:
Kovid Goyal 2022-02-24 00:53:54 +05:30
parent 22c1ee7dc8
commit 6b681df473
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import sys
import tempfile
def compile_terminfo(base):
def compile_terminfo(base, add_other_versions=False):
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,6 +29,13 @@ def compile_terminfo(base):
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():

View File

@ -1256,7 +1256,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)
build_terminfo['compile_terminfo'](odir, add_other_versions=True)
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'))