summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2018-02-18 02:59:03 (GMT)
committerGitHub <noreply@github.com>2018-02-18 02:59:03 (GMT)
commit01423cb53b5662b363d2f1a5963eadfe951ef3e8 (patch)
tree51d62aa19d6ff0d865080974fe8e0a2052ff1aaf /Lib/test/support
parentd6ff8a7037903497eff95fa32bdac2b6adf71505 (diff)
downloadcpython-01423cb53b5662b363d2f1a5963eadfe951ef3e8.zip
cpython-01423cb53b5662b363d2f1a5963eadfe951ef3e8.tar.gz
cpython-01423cb53b5662b363d2f1a5963eadfe951ef3e8.tar.bz2
Improves the ability to build in CI (GH-5728)
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/script_helper.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
index b3ac848..5a81697 100644
--- a/Lib/test/support/script_helper.py
+++ b/Lib/test/support/script_helper.py
@@ -36,6 +36,11 @@ def interpreter_requires_environment():
"""
global __cached_interp_requires_environment
if __cached_interp_requires_environment is None:
+ # If PYTHONHOME is set, assume that we need it
+ if 'PYTHONHOME' in os.environ:
+ __cached_interp_requires_environment = True
+ return True
+
# Try running an interpreter with -E to see if it works or not.
try:
subprocess.check_call([sys.executable, '-E',
@@ -166,7 +171,9 @@ def spawn_python(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw):
kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
object.
"""
- cmd_line = [sys.executable, '-E']
+ cmd_line = [sys.executable]
+ if not interpreter_requires_environment():
+ cmd_line.append('-E')
cmd_line.extend(args)
# Under Fedora (?), GNU readline can output junk on stderr when initialized,
# depending on the TERM setting. Setting TERM=vt100 is supposed to disable