Changeset - cba155768085
[Not reviewed]
default
0 3 0
Mads Kiilerich - 7 years ago 2019-01-07 00:00:18
mads@kiilerich.com
Grafted from: 5b8076dd52ca
middleware: drop fix_PATH

Back out ccbdff90e5a0. That seemed like an odd hack. In order to work properly,
it should not only be applied for protocol access middleware, but also for web
UI and for commands. So evidently, it is not really necessary.

The problem it describes is fixed much better in 5e501b6ee639 by setting the
right python executable in the hook scripts, further improved in 1bafb2d07709
and 6df08d78f8e7 to *actually* use the right python executable.
3 files changed with 2 insertions and 19 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/middleware/simplegit.py
Show inline comments
 
@@ -37,7 +37,7 @@ from webob.exc import HTTPNotFound, HTTP
 
    HTTPNotAcceptable
 
from kallithea.model.db import Ui
 

	
 
from kallithea.lib.utils2 import safe_str, safe_unicode, fix_PATH, get_server_url, \
 
from kallithea.lib.utils2 import safe_str, safe_unicode, get_server_url, \
 
    _set_extras
 
from kallithea.lib.base import BaseVCSController
 
from kallithea.lib.utils import make_ui, is_valid_repo
 
@@ -114,7 +114,6 @@ class SimpleGit(BaseVCSController):
 
        #===================================================================
 
        # GIT REQUEST HANDLING
 
        #===================================================================
 
        fix_PATH()
 
        log.debug('HOOKS extras is %s', extras)
 
        baseui = make_ui()
 
        _set_extras(extras or {})
kallithea/lib/middleware/simplehg.py
Show inline comments
 
@@ -36,7 +36,7 @@ import urllib
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
 
    HTTPNotAcceptable, HTTPBadRequest
 

	
 
from kallithea.lib.utils2 import safe_str, safe_unicode, fix_PATH, get_server_url, \
 
from kallithea.lib.utils2 import safe_str, safe_unicode, get_server_url, \
 
    _set_extras
 
from kallithea.lib.base import BaseVCSController
 
from kallithea.lib.utils import make_ui, is_valid_repo
 
@@ -140,7 +140,6 @@ class SimpleHg(BaseVCSController):
 
        repo_path = os.path.join(safe_str(self.basepath), str_repo_name)
 
        log.debug('Repository path is %s', repo_path)
 

	
 
        fix_PATH()
 
        log.debug('HOOKS extras is %s', extras)
 
        baseui = make_ui(repo_path=repo_path)
 
        _set_extras(extras or {})
kallithea/lib/utils2.py
Show inline comments
 
@@ -506,21 +506,6 @@ class AttributeDict(dict):
 
    __delattr__ = dict.__delitem__
 

	
 

	
 
def fix_PATH(os_=None):
 
    """
 
    Get current active python path, and append it to PATH variable to fix issues
 
    of subprocess calls and different python versions
 
    """
 
    if os_ is None:
 
        import os
 
    else:
 
        os = os_
 

	
 
    cur_path = os.path.split(sys.executable)[0]
 
    if not os.environ['PATH'].startswith(cur_path):
 
        os.environ['PATH'] = '%s:%s' % (cur_path, os.environ['PATH'])
 

	
 

	
 
def obfuscate_url_pw(engine):
 
    from sqlalchemy.engine import url as sa_url
 
    from sqlalchemy.exc import ArgumentError
0 comments (0 inline, 0 general)