changeset 7713:cba155768085

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.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 07 Jan 2019 00:00:18 +0100
parents 62c8b8791a2e
children ce2a4ef8cd5f
files kallithea/lib/middleware/simplegit.py kallithea/lib/middleware/simplehg.py kallithea/lib/utils2.py
diffstat 3 files changed, 2 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/middleware/simplegit.py	Sun May 26 22:41:36 2019 +0200
+++ b/kallithea/lib/middleware/simplegit.py	Mon Jan 07 00:00:18 2019 +0100
@@ -37,7 +37,7 @@
     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 @@
         #===================================================================
         # GIT REQUEST HANDLING
         #===================================================================
-        fix_PATH()
         log.debug('HOOKS extras is %s', extras)
         baseui = make_ui()
         _set_extras(extras or {})
--- a/kallithea/lib/middleware/simplehg.py	Sun May 26 22:41:36 2019 +0200
+++ b/kallithea/lib/middleware/simplehg.py	Mon Jan 07 00:00:18 2019 +0100
@@ -36,7 +36,7 @@
 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 @@
         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 {})
--- a/kallithea/lib/utils2.py	Sun May 26 22:41:36 2019 +0200
+++ b/kallithea/lib/utils2.py	Mon Jan 07 00:00:18 2019 +0100
@@ -506,21 +506,6 @@
     __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