Mercurial > kallithea
changeset 5964:5e501b6ee639
hooks: if available, use sys.executable as executable for git hooks
Windows doesn't necessarily have "python2" available in $PATH, but we still
want to make sure we don't end up invoking a python3. Using the absolute path
seems more safe.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Fri, 29 Apr 2016 16:53:49 +0200 |
parents | 85bb68f64597 |
children | 894ab347d808 |
files | kallithea/config/post_receive_tmpl.py kallithea/config/pre_receive_tmpl.py kallithea/model/scm.py |
diffstat | 3 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/config/post_receive_tmpl.py Thu Jun 09 20:41:44 2016 +0200 +++ b/kallithea/config/post_receive_tmpl.py Fri Apr 29 16:53:49 2016 +0200 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import os import sys
--- a/kallithea/config/pre_receive_tmpl.py Thu Jun 09 20:41:44 2016 +0200 +++ b/kallithea/config/pre_receive_tmpl.py Fri Apr 29 16:53:49 2016 +0200 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 import os import sys
--- a/kallithea/model/scm.py Thu Jun 09 20:41:44 2016 +0200 +++ b/kallithea/model/scm.py Fri Apr 29 16:53:49 2016 +0200 @@ -26,6 +26,7 @@ """ import os +import sys import posixpath import re import time @@ -744,10 +745,12 @@ if not os.path.isdir(loc): os.makedirs(loc) - tmpl_post = pkg_resources.resource_string( + tmpl_post = "#!/usr/bin/env %s\n" % sys.executable or 'python2' + tmpl_post += pkg_resources.resource_string( 'kallithea', jn('config', 'post_receive_tmpl.py') ) - tmpl_pre = pkg_resources.resource_string( + tmpl_pre = "#!/usr/bin/env %s\n" % sys.executable or 'python2' + tmpl_pre += pkg_resources.resource_string( 'kallithea', jn('config', 'pre_receive_tmpl.py') )