diff --git a/kallithea/bin/kallithea_cli_base.py b/kallithea/bin/kallithea_cli_base.py --- a/kallithea/bin/kallithea_cli_base.py +++ b/kallithea/bin/kallithea_cli_base.py @@ -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(): diff --git a/kallithea/bin/kallithea_cli_config.py b/kallithea/bin/kallithea_cli_config.py --- a/kallithea/bin/kallithea_cli_config.py +++ b/kallithea/bin/kallithea_cli_config.py @@ -63,6 +63,7 @@ def config_create(config_file, key_value 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) diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -337,6 +337,9 @@ ssh_authorized_keys = ${user_home_path}/ <%text>## Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve. #kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli +%if kallithea_cli_path: +kallithea_cli_path = ${kallithea_cli_path} +%endif <%text>#################################### <%text>### CELERY CONFIG ####