From 35fb8ea1bf07f4a379e23af5de1718868e190bf8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Jun 2018 14:56:05 +0530 Subject: [PATCH] Linux installer --- docs/installer.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/installer.py b/docs/installer.py index 57d861e39..25c2d1169 100644 --- a/docs/installer.py +++ b/docs/installer.py @@ -160,7 +160,17 @@ def macos_install(dmg, dest='/Applications', launch=True): def linux_install(installer, dest=os.path.expanduser('~/.local'), launch=True): - raise NotImplementedError('TODO: Implement this') + dest = os.path.join(dest, 'kitty.app') + if os.path.exists(dest): + shutil.rmtree(dest) + os.makedirs(dest) + print('Extracting tarball...') + run('tar', '-C', dest, '-xJof', installer) + print('kitty successfully installed to', dest) + kitty = os.path.join(dest, 'bin', 'kitty') + print('Use', kitty, 'to run kitty') + if launch: + run(kitty, '--detach') def main(dest=None, launch=True, installer=None): @@ -189,6 +199,7 @@ def main(dest=None, launch=True, installer=None): def script_launch(): + # To test: python3 -c "import runpy; runpy.run_path('installer.py', run_name='script_launch')" def path(x): return os.path.expandvars(os.path.expanduser(x)) @@ -228,3 +239,5 @@ if __name__ == '__main__' and from_file: main() elif __name__ == 'update_wrapper': update_intaller_wrapper() +elif __name__ == 'script_launch': + script_launch()