# HG changeset patch # User Thomas De Schampheleire <thomas.de_schamphele...@nokia.com> # Date 1554752173 -7200 # Mon Apr 08 21:36:13 2019 +0200 # Branch stable # Node ID bcfc72030155063a2398004e4d55316160d276cb # Parent 90f704f5372af599838b4a8171790eeb89c9749f cli: fill in git_hook_interpreter at 'config-create' time
When generating a configuration file using 'kallithea-cli config-create', fill in the current Python executable as 'git_hook_interpreter' setting. This value will later be used as interpreter (shebang) for Git hooks. As this causes an absolute path to be encoded inside the ini file, moving the virtualenv will require updating this path. For development.ini we do not want such absolute paths which are specific to one developer's machine. Therefore, force the value to be empty in generate-ini.py. diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -122,6 +122,10 @@ commit_parse_limit = 25 ## after '#!' (shebang). When empty or not defined, the value of ## 'sys.executable' at the time of installation of the git hooks is ## used, which is correct in many cases but not when using uwsgi. +## When creating a config file via `kallithea-cli config-create`, the +## Python executable used for that invocation is filled in below. +## If you change this setting, you should reinstall the git hooks via +## Admin > Settings > Remap and Rescan. ## FIXME this setting is not yet used. # git_hook_interpreter = /srv/kallithea/venv/bin/python2 diff --git a/kallithea/lib/inifile.py b/kallithea/lib/inifile.py --- a/kallithea/lib/inifile.py +++ b/kallithea/lib/inifile.py @@ -23,6 +23,7 @@ other custom values. import logging import re import os +import sys import mako.template @@ -40,6 +41,7 @@ default_variables = { 'host': '127.0.0.1', 'port': '5000', 'uuid': lambda: 'VERY-SECRET', + 'git_hook_interpreter': sys.executable, } 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 @@ -216,6 +216,10 @@ commit_parse_limit = 25 <%text>## after '#!' (shebang). When empty or not defined, the value of</%text> <%text>## 'sys.executable' at the time of installation of the git hooks is</%text> <%text>## used, which is correct in many cases but not when using uwsgi.</%text> +<%text>## When creating a config file via `kallithea-cli config-create`, the</%text> +<%text>## Python executable used for that invocation is filled in below.</%text> +<%text>## If you change this setting, you should reinstall the git hooks via</%text> +<%text>## Admin > Settings > Remap and Rescan.</%text> <%text>## FIXME this setting is not yet used.</%text> # git_hook_interpreter = /srv/kallithea/venv/bin/python2 %if git_hook_interpreter: diff --git a/scripts/generate-ini.py b/scripts/generate-ini.py --- a/scripts/generate-ini.py +++ b/scripts/generate-ini.py @@ -48,6 +48,7 @@ ini_files = [ }, }, { + 'git_hook_interpreter': '', }, ), ] _______________________________________________ kallithea-general mailing list kallithea-general@sfconservancy.org https://lists.sfconservancy.org/mailman/listinfo/kallithea-general