Changeset - dd88fd3a45cc
[Not reviewed]
stable
0 1 0
Thomas De Schampheleire - 7 years ago 2019-04-08 22:06:12
thomas.de_schampheleire@nokia.com
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.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/model/scm.py
Show inline comments
 
@@ -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')
 
        )
0 comments (0 inline, 0 general)