Commit 9e5ba82d authored by Jérome Perrin's avatar Jérome Perrin

slap/standalone: don't unset PYTHONPATH

We were doing this because we use to run tests with `python setup.py test`
which automatically sets PYTHONPATH, so it was affecting sub processes
started by standalone.

Nowadays we no longer use this method of running tests, so we are not really
supposed to use PYTHONPATH, so we don't unset this environment variable,
there might be valid cases where users want to force a different python path
(but I can not think of any) and it simplifies the code a bit.
parent 7918f6c7
......@@ -711,7 +711,6 @@ class StandaloneSlapOS(object):
return subprocess.check_call(
command,
shell=True,
env=self._getSubprocessEnvironment(),
)
except subprocess.CalledProcessError as e:
if e.returncode == SLAPGRID_PROMISE_FAIL:
......@@ -775,7 +774,6 @@ class StandaloneSlapOS(object):
output = subprocess.check_output(
['supervisord', '--configuration', self._supervisor_config],
cwd=self._base_directory,
env=self._getSubprocessEnvironment(),
)
self._logger.debug("Started new supervisor: %s", output)
......@@ -806,14 +804,3 @@ class StandaloneSlapOS(object):
return
time.sleep(i * .01)
raise RuntimeError("SlapOS not started")
def _getSubprocessEnvironment(self):
# Running tests with `python setup.py test` sets a PYTHONPATH that
# is suitable for current python, but problematic when this process
# runs another version of python in subprocess.
if 'PYTHONPATH' in os.environ:
self._logger.warning(
"Removing $PYTHONPATH from environment for subprocess")
env = os.environ.copy()
del env['PYTHONPATH']
return env
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment