forked from qt-creator/qt-creator
GDB: Fix detection of python for GDB on windows
Task-number: QTCREATORBUG-3375 Reviewed-by: hjk
This commit is contained in:
@@ -4036,31 +4036,31 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
|||||||
|
|
||||||
const QString winPythonVersion = QLatin1String(winPythonVersionC);
|
const QString winPythonVersion = QLatin1String(winPythonVersionC);
|
||||||
const QDir dir = fi.absoluteDir();
|
const QDir dir = fi.absoluteDir();
|
||||||
if (!dir.exists(winPythonVersion)) {
|
|
||||||
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 "
|
|
||||||
"find a valid python installation in its %2 subdirectory.\n"
|
|
||||||
"You may set the PYTHONPATH to your installation.")
|
|
||||||
.arg(m_gdb).arg(winPythonVersion);
|
|
||||||
handleAdapterStartFailed(msg, settingsIdHint);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcessEnvironment environment = gdbProc()->processEnvironment();
|
QProcessEnvironment environment = gdbProc()->processEnvironment();
|
||||||
const QString pythonPathVariable = QLatin1String("PYTHONPATH");
|
const QString pythonPathVariable = QLatin1String("PYTHONPATH");
|
||||||
// Check for existing values.
|
QString pythonPath;
|
||||||
if (environment.contains(pythonPathVariable)) {
|
|
||||||
const QString oldPythonPath = environment.value(pythonPathVariable);
|
if (dir.exists(winPythonVersion)) {
|
||||||
showMessage(_("Using existing python path: %1")
|
pythonPath = QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
||||||
.arg(oldPythonPath), LogMisc);
|
} else if (dir.exists(QLatin1String("lib"))) { // Needed for our gdb 7.2 packages
|
||||||
|
pythonPath = QDir::toNativeSeparators(dir.absoluteFilePath(QLatin1String("lib")));
|
||||||
} else {
|
} else {
|
||||||
const QString pythonPath =
|
if (environment.contains(pythonPathVariable)) {
|
||||||
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
pythonPath = environment.value(pythonPathVariable);
|
||||||
environment.insert(pythonPathVariable, pythonPath);
|
} else {
|
||||||
showMessage(_("Python path: %1").arg(pythonPath), LogMisc);
|
showMessage(_("GDB %1 CANNOT FIND PYTHON INSTALLATION.").arg(m_gdb));
|
||||||
gdbProc()->setProcessEnvironment(environment);
|
showStatusMessage(_("Gdb at %1 cannot find python").arg(m_gdb));
|
||||||
|
const QString msg = tr("The gdb installed at %1 cannot "
|
||||||
|
"find a valid python installation in its %2 subdirectory.\n"
|
||||||
|
"You may set the PYTHONPATH to your installation.")
|
||||||
|
.arg(m_gdb).arg(winPythonVersion);
|
||||||
|
handleAdapterStartFailed(msg, settingsIdHint);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
environment.insert(pythonPathVariable, pythonPath);
|
||||||
|
showMessage(_("Python path: %1").arg(pythonPath), LogMisc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(gdbProc(), SIGNAL(error(QProcess::ProcessError)),
|
connect(gdbProc(), SIGNAL(error(QProcess::ProcessError)),
|
||||||
|
|||||||
Reference in New Issue
Block a user