changeset 7632:dd88fd3a45cc stable

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.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Mon, 08 Apr 2019 22:06:12 +0200
parents 98deccab042c
children 1bafb2d07709
files kallithea/model/scm.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/scm.py	Wed Apr 10 21:54:50 2019 +0200
+++ b/kallithea/model/scm.py	Mon Apr 08 22:06:12 2019 +0200
@@ -729,7 +729,7 @@
         """
         # 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 @@
         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')
         )