Mercurial > kallithea
changeset 7779:a185042de98a
kallithea-cli: set kallithea_cli_path when creating .ini file so it doesn't have to be set manually before using ssh
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 30 Jun 2019 13:31:56 +0200 |
parents | 267c0dbcddd3 |
children | 955bbbc29655 |
files | kallithea/bin/kallithea_cli_base.py kallithea/bin/kallithea_cli_config.py kallithea/lib/paster_commands/template.ini.mako |
diffstat | 3 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_base.py Sat Jun 22 19:46:25 2019 +0200 +++ b/kallithea/bin/kallithea_cli_base.py Sun Jun 30 13:31:56 2019 +0200 @@ -15,12 +15,22 @@ import click import functools import os +import sys import kallithea import logging.config import paste.deploy +# kallithea_cli is usually invoked through the 'kallithea-cli' wrapper script +# that is installed by setuptools, as specified in setup.py console_scripts +# entry_points. The script will be using the right virtualenv (if any), and for +# Unix, it will contain #! pointing at the right python executable. The script +# also makes sure sys.argv[0] points back at the script path, and that is what +# can be used to invoke 'kallithea-cli' later. +kallithea_cli_path = sys.argv[0] + + # This placeholder is the main entry point for the kallithea-cli command @click.group(context_settings=dict(help_option_names=['-h', '--help'])) def cli():
--- a/kallithea/bin/kallithea_cli_config.py Sat Jun 22 19:46:25 2019 +0200 +++ b/kallithea/bin/kallithea_cli_config.py Sun Jun 30 13:31:56 2019 +0200 @@ -63,6 +63,7 @@ mako_variable_values = { 'git_hook_interpreter': sys.executable, 'user_home_path': os.path.expanduser('~'), + 'kallithea_cli_path': cli_base.kallithea_cli_path, } ini_settings = defaultdict(dict)
--- a/kallithea/lib/paster_commands/template.ini.mako Sat Jun 22 19:46:25 2019 +0200 +++ b/kallithea/lib/paster_commands/template.ini.mako Sun Jun 30 13:31:56 2019 +0200 @@ -337,6 +337,9 @@ <%text>## Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve.</%text> #kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli +%if kallithea_cli_path: +kallithea_cli_path = ${kallithea_cli_path} +%endif <%text>####################################</%text> <%text>### CELERY CONFIG ####</%text>