# HG changeset patch # User Mads Kiilerich # Date 2019-01-07 00:00:18 # Node ID cba155768085d726fdeee797cdc93d46f2d31bd8 # Parent 62c8b8791a2e756d16e4c05a714d03281799a5b1 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. diff --git a/kallithea/lib/middleware/simplegit.py b/kallithea/lib/middleware/simplegit.py --- a/kallithea/lib/middleware/simplegit.py +++ b/kallithea/lib/middleware/simplegit.py @@ -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 {}) diff --git a/kallithea/lib/middleware/simplehg.py b/kallithea/lib/middleware/simplehg.py --- a/kallithea/lib/middleware/simplehg.py +++ b/kallithea/lib/middleware/simplehg.py @@ -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 {}) diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py --- a/kallithea/lib/utils2.py +++ b/kallithea/lib/utils2.py @@ -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