Changeset - 5e501b6ee639
[Not reviewed]
default
0 3 0
domruf - 10 years ago 2016-04-29 16:53:49
dominikruf@gmail.com
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.
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/config/post_receive_tmpl.py
Show inline comments
 
#!/usr/bin/env python2
 
import os
 
import sys
 

	
kallithea/config/pre_receive_tmpl.py
Show inline comments
 
#!/usr/bin/env python2
 
import os
 
import sys
 

	
kallithea/model/scm.py
Show inline comments
 
@@ -26,6 +26,7 @@ Original author and date, and relevant c
 
"""
 

	
 
import os
 
import sys
 
import posixpath
 
import re
 
import time
 
@@ -744,10 +745,12 @@ class ScmModel(BaseModel):
 
        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')
 
        )
 

	
0 comments (0 inline, 0 general)