Merge pull request #170545 from malob/update-kitty
kitty: 0.24.4 -> 0.25.0
This commit is contained in:
commit
c1d9497b81
@ -28,14 +28,14 @@
|
||||
with python3Packages;
|
||||
buildPythonApplication rec {
|
||||
pname = "kitty";
|
||||
version = "0.24.4";
|
||||
version = "0.25.0";
|
||||
format = "other";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kovidgoyal";
|
||||
repo = "kitty";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-c6XM/xeGZ68srf8xQJA1iYCUR3kXNceTMxsZAnbFmug=";
|
||||
sha256 = "sha256-RYQVcbyKIv/FlrtROoQywWR+iF+4KYiYrrzErUrOCWM=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
@ -78,21 +78,26 @@ buildPythonApplication rec {
|
||||
outputs = [ "out" "terminfo" "shell_integration" ];
|
||||
|
||||
patches = [
|
||||
# Required to get `test_ssh_env_vars` to pass.
|
||||
(fetchpatch {
|
||||
name = "fix-zsh-completion-test-1.patch";
|
||||
url = "https://github.com/kovidgoyal/kitty/commit/297592242c290a81ca4ba08802841f4c33a4de25.patch";
|
||||
sha256 = "sha256-/V6y/4AaJsZvx1KS5UFZ+0zyAoZuLgbgFORZ1dX/1qE=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "fix-zsh-completion-test-2.patch";
|
||||
url = "https://github.com/kovidgoyal/kitty/commit/d8ed42ae8e014d9abf9550a65ae203468f8bfa43.patch";
|
||||
sha256 = "sha256-Azgzqf5atW999FVn9rSGKMyZLsI692dYXhJPx07GBO0=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "fix-build-with-non-framework-python-on-darwin.patch";
|
||||
url = "https://github.com/kovidgoyal/kitty/commit/57cffc71b78244e6a9d49f4c9af24d1a88dbf537.patch";
|
||||
sha256 = "sha256-1IGONSVCVo5SmLKw90eqxaI5Mwc764O1ur+aMsc7h94=";
|
||||
name = "increase-pty-lines.patch";
|
||||
url = "https://github.com/kovidgoyal/kitty/commit/eb84990f5a8edc458e04d24cc1cda05316d74ceb.patch";
|
||||
sha256 = "sha256-eOANfhGPMoN4FqxtIGDBu5X0O3RPLABDnL+LKqSLROI=";
|
||||
})
|
||||
# Fix to ensure that files in tar files used by SSH kitten have write permissions.
|
||||
./tarball-restore-write-permissions.patch
|
||||
|
||||
# Needed on darwin
|
||||
|
||||
# Gets `test_ssh_shell_integration` to pass for `zsh` when `compinit` complains about
|
||||
# permissions.
|
||||
./zsh-compinit.patch
|
||||
# Skip `test_ssh_login_shell_detection` in some cases, build users have their shell set to
|
||||
# `/sbin/nologin` which causes issues.
|
||||
./disable-test_ssh_login_shell_detection.patch
|
||||
# Skip `test_ssh_bootstrap_with_different_launchers` when launcher is `zsh` since it causes:
|
||||
# OSError: master_fd is in error condition
|
||||
./disable-test_ssh_bootstrap_with_different_launchers.patch
|
||||
];
|
||||
|
||||
# Causes build failure due to warning
|
||||
@ -141,6 +146,9 @@ buildPythonApplication rec {
|
||||
# Fontconfig error: Cannot load default config file: No such file: (null)
|
||||
export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
|
||||
|
||||
# Required for `test_ssh_shell_integration` to pass.
|
||||
export TERM=kitty
|
||||
|
||||
env PATH="${buildBinPath}:$PATH" ${python.interpreter} test.py
|
||||
'';
|
||||
|
||||
@ -180,6 +188,18 @@ buildPythonApplication rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# Patch shebangs that Nix can't automatically patch
|
||||
preFixup =
|
||||
let
|
||||
pathComponent = if stdenv.isDarwin then "Applications/kitty.app/Contents/Resources" else "lib";
|
||||
in
|
||||
''
|
||||
substituteInPlace $out/${pathComponent}/kitty/shell-integration/ssh/askpass.py \
|
||||
--replace '/usr/bin/env -S ' $out/bin/
|
||||
substituteInPlace $shell_integration/ssh/askpass.py \
|
||||
--replace '/usr/bin/env -S ' $out/bin/
|
||||
'';
|
||||
|
||||
passthru.tests.test = nixosTests.terminal-emulators.kitty;
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -0,0 +1,13 @@
|
||||
diff --git a/kitty_tests/ssh.py b/kitty_tests/ssh.py
|
||||
index 1f424146..d3cc191b 100644
|
||||
--- a/kitty_tests/ssh.py
|
||||
+++ b/kitty_tests/ssh.py
|
||||
@@ -166,7 +166,7 @@ def test_ssh_bootstrap_with_different_launchers(self):
|
||||
for sh in self.all_possible_sh:
|
||||
if sh == 'sh' or 'python' in sh:
|
||||
q = shutil.which(launcher)
|
||||
- if q:
|
||||
+ if q and not 'zsh' in q:
|
||||
with self.subTest(sh=sh, launcher=q), tempfile.TemporaryDirectory() as tdir:
|
||||
self.check_bootstrap(sh, tdir, test_script='env; exit 0', SHELL_INTEGRATION_VALUE='', launcher=q)
|
||||
|
@ -0,0 +1,13 @@
|
||||
diff --git a/kitty_tests/ssh.py b/kitty_tests/ssh.py
|
||||
index 1f424146..57620334 100644
|
||||
--- a/kitty_tests/ssh.py
|
||||
+++ b/kitty_tests/ssh.py
|
||||
@@ -197,7 +197,7 @@ def test_ssh_login_shell_detection(self):
|
||||
expected_login_shell = pwd.getpwuid(os.geteuid()).pw_shell
|
||||
for m in methods:
|
||||
for sh in self.all_possible_sh:
|
||||
- if 'python' in sh:
|
||||
+ if 'python' in sh or '/sbin/nologin' in expected_login_shell:
|
||||
continue
|
||||
with self.subTest(sh=sh, method=m), tempfile.TemporaryDirectory() as tdir:
|
||||
pty = self.check_bootstrap(sh, tdir, test_script=f'{m}; echo "$login_shell"; exit 0', SHELL_INTEGRATION_VALUE='')
|
@ -0,0 +1,27 @@
|
||||
From 59f6876187da2c01b35e696e169ca98239c08a41 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Felice <jason.m.felice@gmail.com>
|
||||
Date: Tue, 24 May 2022 07:54:25 -0400
|
||||
Subject: [PATCH] Restore write permissions in tarball
|
||||
|
||||
In Nix, the source files are stored in an immutable store and
|
||||
therefore have been stripped of write permissions. When the SSH
|
||||
kitten makes the tarfile, the files contained in it are also missing
|
||||
the write permissions, causing commands on the remote side to fail.
|
||||
---
|
||||
kittens/ssh/main.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/kittens/ssh/main.py b/kittens/ssh/main.py
|
||||
index 0b50d5ff..f80ac13d 100644
|
||||
--- a/kittens/ssh/main.py
|
||||
+++ b/kittens/ssh/main.py
|
||||
@@ -123,6 +123,7 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str], compression: st
|
||||
def normalize_tarinfo(tarinfo: tarfile.TarInfo) -> tarfile.TarInfo:
|
||||
tarinfo.uname = tarinfo.gname = ''
|
||||
tarinfo.uid = tarinfo.gid = 0
|
||||
+ tarinfo.mode |= 0o200
|
||||
return tarinfo
|
||||
|
||||
def add_data_as_file(tf: tarfile.TarFile, arcname: str, data: Union[str, bytes]) -> tarfile.TarInfo:
|
||||
--
|
||||
2.36.0
|
@ -0,0 +1,13 @@
|
||||
diff --git a/kitty_tests/ssh.py b/kitty_tests/ssh.py
|
||||
index 1f424146..d9a65d25 100644
|
||||
--- a/kitty_tests/ssh.py
|
||||
+++ b/kitty_tests/ssh.py
|
||||
@@ -268,6 +268,8 @@ def check_untar_or_fail():
|
||||
return 'UNTAR_DONE' in q
|
||||
pty.wait_till(check_untar_or_fail)
|
||||
self.assertTrue(os.path.exists(os.path.join(home_dir, '.terminfo/kitty.terminfo')))
|
||||
+ if login_shell == 'zsh':
|
||||
+ pty.send_cmd_to_child('y')
|
||||
if SHELL_INTEGRATION_VALUE != 'enabled':
|
||||
pty.wait_till(lambda: len(pty.screen_contents().splitlines()) > 1)
|
||||
self.assertEqual(pty.screen.cursor.shape, 0)
|
Loading…
Reference in New Issue
Block a user