aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qtcreatorcdbext
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2020-10-29 11:15:04 +0100
committerDavid Schulz <david.schulz@qt.io>2020-11-03 05:01:15 +0000
commitfc39cf18e11f81a8d6f748b9b383f632343dab80 (patch)
tree652aa6bfae41c44775b8a4560f0ece28bd19e1dd /src/libs/qtcreatorcdbext
parent495dee98fc1af69bd22ff7f815da85787694d8f4 (diff)
Debugger: fix debugger in modified python environment
We do not want to pick up any python environment variables for the cdbext python initialization which might change the module search path, because we already contain the needed python modules in the zip file next to the extension. Fixes: QTCREATORBUG-24859 Change-Id: I0d597f42042d249529309263d71b0e740e903a48 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/libs/qtcreatorcdbext')
-rw-r--r--src/libs/qtcreatorcdbext/CMakeLists.txt4
-rw-r--r--src/libs/qtcreatorcdbext/extensioncontext.cpp9
-rw-r--r--src/libs/qtcreatorcdbext/qtcreatorcdbext.pro2
-rw-r--r--src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs7
-rw-r--r--src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp2
5 files changed, 16 insertions, 8 deletions
diff --git a/src/libs/qtcreatorcdbext/CMakeLists.txt b/src/libs/qtcreatorcdbext/CMakeLists.txt
index b6171d183d..45d55474aa 100644
--- a/src/libs/qtcreatorcdbext/CMakeLists.txt
+++ b/src/libs/qtcreatorcdbext/CMakeLists.txt
@@ -45,9 +45,9 @@ add_qtc_library(qtcreatorcdbext
qtc_library_enabled(_library_enabled qtcreatorcdbext)
if (_library_enabled)
- find_package(PythonLibs 3.5)
+ find_package(PythonLibs 3.8)
if (NOT ${PYTHONLIBS_FOUND})
- message(WARNING "PythonLibs (at least version 3.5) not found. qtcreatorcdbext will be built without Python support.")
+ message(WARNING "PythonLibs (at least version 3.8) not found. qtcreatorcdbext will be built without Python support.")
return()
endif()
diff --git a/src/libs/qtcreatorcdbext/extensioncontext.cpp b/src/libs/qtcreatorcdbext/extensioncontext.cpp
index c6ae69fac7..4842289c67 100644
--- a/src/libs/qtcreatorcdbext/extensioncontext.cpp
+++ b/src/libs/qtcreatorcdbext/extensioncontext.cpp
@@ -162,7 +162,14 @@ HRESULT ExtensionContext::initialize(PULONG Version, PULONG Flags)
#ifdef WITH_PYTHON
initCdbextPythonModule();
- Py_Initialize();
+ PyStatus status;
+ PyConfig config;
+ PyConfig_InitIsolatedConfig(&config);
+ status = Py_InitializeFromConfig(&config);
+ PyConfig_Clear(&config);
+ if (PyStatus_Exception(status)) {
+ Py_ExitStatusException(status);
+ }
PyRun_SimpleString("import cdbext");
PyRun_SimpleString("import sys");
#endif
diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro b/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro
index 98961887b9..f9f30f925f 100644
--- a/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro
+++ b/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro
@@ -114,7 +114,7 @@ isEmpty(PYTHON_INSTALL_DIR):PYTHON_INSTALL_DIR=$$(PYTHON_INSTALL_DIR)
CONFIG(debug, debug|release): deploy_python.recurse = Debug
QMAKE_EXTRA_TARGETS += deploy_python
} else {
- message("Set PYTHON_INSTALL_DIR pointing to Python 3.5 or greater to enable the python dumpers for cdb.")
+ message("Set PYTHON_INSTALL_DIR pointing to Python 3.8 or greater to enable the python dumpers for cdb.")
}
target.path = $$QTC_PREFIX/lib/$${DIRNAME} # TODO this should go to INSTALL_LIBRARY_PATH/$${DIRNAME}
diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs b/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs
index 3f446e2916..fac2f7a25b 100644
--- a/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs
+++ b/src/libs/qtcreatorcdbext/qtcreatorcdbext.qbs
@@ -50,10 +50,11 @@ QtcLibrary {
+ output + "'");
return;
}
- if (Utilities.versionCompare(versionNumberString, "3.5") < 0) {
+ var pythonMinVersion = "3.8";
+ if (Utilities.versionCompare(versionNumberString, pythonMinVersion) < 0) {
printWarning("The python installation at '" + pythonDir
- + "' has version " + versionNumberString + ", but 3.5 or higher "
- + "is required.");
+ + "' has version " + versionNumberString + ", but "
+ + pythonMinVersion + " or higher is required.");
return;
}
found = true;
diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp
index f4dcde9736..4895fb6c2e 100644
--- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp
+++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp
@@ -654,7 +654,7 @@ extern "C" HRESULT CALLBACK script(CIDebugClient *client, PCSTR argsIn)
ExtensionContext::instance().report('N', token, 0, "script",
"Python is not supported in this CDB extension.\n"
"You need to define PYTHON_INSTALL_DIR in your creator build environment "
- "pointing to a Python 3.5 installation.");
+ "pointing to a Python 3.8 installation.");
#endif
return S_OK;
}