[ScriptInterpreter] Make sure that PYTHONHOME is right.

Summary:
For the only version of Python actually supported on Darwin.

<rdar://problem/40961425>

Reviewers: jingham, friss, JDevlieghere, aprantl, jasonmolenda

Subscribers: jdoerfert, llvm-commits, lldb-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59719

llvm-svn: 356816
This commit is contained in:
Davide Italiano
2019-03-22 22:19:57 +00:00
parent 74d5b33222
commit 386f00db75

View File

@@ -176,6 +176,16 @@ private:
static char g_python_home[] = LLDB_PYTHON_HOME;
#endif
Py_SetPythonHome(g_python_home);
#endif
#else
#if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
// For Darwin, the only Python version supported is the one shipped in the OS
// and linked with lldb. Other installation of Python may have higher priorities
// in the path, overriding PYTHONHOME and causing problems/incompatibilities.
// In order to avoid confusion, always hardcode the PythonHome to be right,
// as it's not going to change.
Py_SetPythonHome("/System/Library/Frameworks/Python.framework/Versions/2.7");
#endif
#endif
}