GUI: Set PYTHONPATH

This commit is contained in:
Daniel Marjamäki 2017-10-07 16:21:35 +02:00
parent ec55313c28
commit 92314b65e9
2 changed files with 7 additions and 1 deletions

5
gui/checkthread.cpp Normal file → Executable file
View File

@ -296,6 +296,11 @@ void CheckThread::runAddonsAndTools(const QString &addonPath, const ImportProjec
qDebug() << python << args; qDebug() << python << args;
QProcess process; QProcess process;
QProcessEnvironment env = process.processEnvironment();
if (!env.contains("PYTHONHOME") && !mPythonPath.isEmpty()) {
env.insert("PYTHONHOME", QFileInfo(mPythonPath).canonicalPath());
process.setProcessEnvironment(env);
}
process.start(python, args); process.start(python, args);
process.waitForFinished(); process.waitForFinished();
const QString errout(process.readAllStandardError()); const QString errout(process.readAllStandardError());

View File

@ -49,7 +49,8 @@
static const QString OnlineHelpURL("http://cppcheck.net/manual.html"); static const QString OnlineHelpURL("http://cppcheck.net/manual.html");
static const QString compile_commands_json("compile_commands.json"); static const QString compile_commands_json("compile_commands.json");
static QString getDataDir(const QSettings *settings) { static QString getDataDir(const QSettings *settings)
{
const QString dataDir = settings->value("DATADIR", QString()).toString(); const QString dataDir = settings->value("DATADIR", QString()).toString();
const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath(); const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath();
return dataDir.isEmpty() ? appPath : dataDir; return dataDir.isEmpty() ? appPath : dataDir;