Commit 07cac219 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

GDB: Fix detection of python for GDB on windows

Task-number: QTCREATORBUG-3375
Reviewed-by: hjk
parent b32873d3
......@@ -4036,7 +4036,19 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
const QString winPythonVersion = QLatin1String(winPythonVersionC);
const QDir dir = fi.absoluteDir();
if (!dir.exists(winPythonVersion)) {
QProcessEnvironment environment = gdbProc()->processEnvironment();
const QString pythonPathVariable = QLatin1String("PYTHONPATH");
QString pythonPath;
if (dir.exists(winPythonVersion)) {
pythonPath = QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
} else if (dir.exists(QLatin1String("lib"))) { // Needed for our gdb 7.2 packages
pythonPath = QDir::toNativeSeparators(dir.absoluteFilePath(QLatin1String("lib")));
} else {
if (environment.contains(pythonPathVariable)) {
pythonPath = environment.value(pythonPathVariable);
} else {
showMessage(_("GDB %1 CANNOT FIND PYTHON INSTALLATION.").arg(m_gdb));
showStatusMessage(_("Gdb at %1 cannot find python").arg(m_gdb));
const QString msg = tr("The gdb installed at %1 cannot "
......@@ -4046,21 +4058,9 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
handleAdapterStartFailed(msg, settingsIdHint);
return false;
}
QProcessEnvironment environment = gdbProc()->processEnvironment();
const QString pythonPathVariable = QLatin1String("PYTHONPATH");
// Check for existing values.
if (environment.contains(pythonPathVariable)) {
const QString oldPythonPath = environment.value(pythonPathVariable);
showMessage(_("Using existing python path: %1")
.arg(oldPythonPath), LogMisc);
} else {
const QString pythonPath =
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
}
environment.insert(pythonPathVariable, pythonPath);
showMessage(_("Python path: %1").arg(pythonPath), LogMisc);
gdbProc()->setProcessEnvironment(environment);
}
#endif
connect(gdbProc(), SIGNAL(error(QProcess::ProcessError)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment