davide created this revision. davide added reviewers: jingham, friss, JDevlieghere, aprantl, jasonmolenda. Herald added subscribers: llvm-commits, jdoerfert. Herald added a project: LLVM.
For the only version of Python actually supported on Darwin. rdar://problem/40961425 Repository: rL LLVM https://reviews.llvm.org/D59719 Files: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -176,6 +176,16 @@ static char g_python_home[] = LLDB_PYTHON_HOME; #endif Py_SetPythonHome(g_python_home); +#endif +#else +#if defined(__APPLE__) && PY_MAJOR_VERSION == 2 + // 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 }
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -176,6 +176,16 @@ static char g_python_home[] = LLDB_PYTHON_HOME; #endif Py_SetPythonHome(g_python_home); +#endif +#else +#if defined(__APPLE__) && PY_MAJOR_VERSION == 2 + // 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 }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits