# HG changeset patch # User Thomas De Schampheleire # Date 2019-04-08 22:06:12 # Node ID dd88fd3a45cc29775efa2ed7c5060578cada94a3 # Parent 98deccab042c5b9e1fc91928f295f6a19ad4dd17 hooks: use /usr/bin/env only when needed The use of /usr/bin/env is only needed for relative arguments (or to pass variables in the environment, which we don't do). It is thus not needed in case the Python interpreter for Git hooks is known with absolute path, as introduced in 5e501b6ee639. diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -729,7 +729,7 @@ class ScmModel(object): """ # FIXME This may not work on Windows and may need a shell wrapper script. return (sys.executable - or 'python2') + or '/usr/bin/env python2') def install_git_hooks(self, repo, force_create=False): """ @@ -745,11 +745,11 @@ class ScmModel(object): if not os.path.isdir(loc): os.makedirs(loc) - tmpl_post = "#!/usr/bin/env %s\n" % self._get_git_hook_interpreter() + tmpl_post = "#!%s\n" % self._get_git_hook_interpreter() tmpl_post += pkg_resources.resource_string( 'kallithea', os.path.join('config', 'post_receive_tmpl.py') ) - tmpl_pre = "#!/usr/bin/env %s\n" % self._get_git_hook_interpreter() + tmpl_pre = "#!%s\n" % self._get_git_hook_interpreter() tmpl_pre += pkg_resources.resource_string( 'kallithea', os.path.join('config', 'pre_receive_tmpl.py') )