mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 09:29:55 +00:00
Setenv PYTHONHOME not Py_SetPythonHome
.. what a clusterfuck the Python embedding API is. If you set PYTHONHOME it loses PYTHONPATH. But only on a Mac. Go figure. .. so we just set the environment to the user defined value in prefs.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "Settings.h"
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
|
||||
@@ -177,6 +178,9 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
|
||||
// config or environment variable
|
||||
QString PYTHONHOME = appsettings->value(NULL, GC_PYTHON_HOME, "").toString();
|
||||
if (PYTHONHOME == "") PYTHONHOME = QProcessEnvironment::systemEnvironment().value("PYTHONHOME", "");
|
||||
else {
|
||||
qputenv("PYTHONHOME",PYTHONHOME.toUtf8());
|
||||
}
|
||||
if (PYTHONHOME !="") printd("PYTHONHOME setting used: %s\n", PYTHONHOME.toStdString().c_str());
|
||||
|
||||
// is python3 installed?
|
||||
@@ -184,12 +188,6 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
|
||||
|
||||
printd("Python is installed: %s\n", pybin.toStdString().c_str());
|
||||
|
||||
// set PYTHONHOME if user specified it
|
||||
if (PYTHONHOME != "") {
|
||||
printd("Py_SetPythonHome: %s\n", pybin.toStdString().c_str());
|
||||
Py_SetPythonHome((wchar_t*) PYTHONHOME.toStdString().c_str());
|
||||
}
|
||||
|
||||
// tell python our program name - pretend to be the usual interpreter
|
||||
printd("Py_SetProgramName: %s\n", pybin.toStdString().c_str());
|
||||
Py_SetProgramName((wchar_t*) pybin.toStdString().c_str());
|
||||
|
||||
Reference in New Issue
Block a user