ssh kitten: Fix executable permission missing from kitty bootstrap script

Fixes #5438
This commit is contained in:
Kovid Goyal
2022-08-29 18:20:09 +05:30
parent 16a4845a72
commit c68b82e4d0
3 changed files with 26 additions and 3 deletions

View File

@@ -1363,10 +1363,19 @@ def package(args: Options, bundle_type: str) -> None:
f.seek(0), f.truncate(), f.write(raw)
compile_python(libdir)
def should_be_executable(path: str) -> bool:
if path.endswith('.so'):
return True
q = path.split(os.sep)[-2:]
if len(q) == 2 and q[0] == 'ssh' and q[1] in ('askpass.py', 'kitty'):
return True
return False
for root, dirs, files in os.walk(libdir):
for f_ in files:
path = os.path.join(root, f_)
os.chmod(path, 0o755 if f_.endswith('.so') or os.path.basename(f_) == 'askpass.py' else 0o644)
os.chmod(path, 0o755 if should_be_executable(path) else 0o644)
if not is_macos:
create_linux_bundle_gunk(ddir, args.libdir_name)