aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorStella Stamenova <stilis@microsoft.com>2020-02-21 14:56:17 -0800
committerStella Stamenova <stilis@microsoft.com>2020-02-21 14:57:00 -0800
commit215a31115f89c851331a822e67aa4528ba5c21e6 (patch)
tree7e2a08b2bf6b3e83a5b2c41f06c5d3ad174a1ccb /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parenta32d539798e4f0b97420e7b60b223b3a3fae5ff1 (diff)
downloadllvm-215a31115f89c851331a822e67aa4528ba5c21e6.zip
llvm-215a31115f89c851331a822e67aa4528ba5c21e6.tar.gz
llvm-215a31115f89c851331a822e67aa4528ba5c21e6.tar.bz2
Revert "Allow customized relative PYTHONHOME"
This reverts commit 0bb90628b5f7c170689d2d3f019af773772fc649 since it is causing failures on the Windows LLDB buildbot: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/14048
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index f046bcf..722af71 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -277,36 +277,14 @@ public:
private:
void InitializePythonHome() {
-#if LLDB_EMBED_PYTHON_HOME
+#if defined(LLDB_PYTHON_HOME)
#if PY_MAJOR_VERSION >= 3
- typedef const wchar_t* str_type;
+ size_t size = 0;
+ static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, &size);
#else
- typedef char* str_type;
+ static char g_python_home[] = LLDB_PYTHON_HOME;
#endif
- static str_type g_python_home = []() -> str_type {
- const char *lldb_python_home = LLDB_PYTHON_HOME;
- const char *absolute_python_home = nullptr;
- llvm::SmallString<64> path;
- if (llvm::sys::path::is_absolute(lldb_python_home)) {
- absolute_python_home = lldb_python_home;
- } else {
- FileSpec spec = HostInfo::GetShlibDir();
- if (!spec)
- return nullptr;
- spec.GetPath(path);
- llvm::sys::path::append(path, lldb_python_home);
- absolute_python_home = path.c_str();
- }
-#if PY_MAJOR_VERSION >= 3
- size_t size = 0;
- return Py_DecodeLocale(absolute_python_home, &size);
-#else
- return strdup(absolute_python_home);
-#endif
- }();
- if (g_python_home != nullptr) {
- Py_SetPythonHome(g_python_home);
- }
+ Py_SetPythonHome(g_python_home);
#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