mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 02:25:26 +00:00
Set PYTHONHOME for AppImage
Keep PYTHONHOME string
This commit is contained in:
parent
78c3e5f1e3
commit
0ec363a214
@ -8,6 +8,8 @@
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
|
||||
#include "JupyterConnection.h"
|
||||
#include "NestedIPyKernel.h"
|
||||
@ -39,11 +41,26 @@ JupyterConnection::~JupyterConnection()
|
||||
|
||||
Py_Finalize();
|
||||
}
|
||||
|
||||
if (pythonHome)
|
||||
{
|
||||
PyMem_RawFree(pythonHome);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JupyterConnection::initPython()
|
||||
{
|
||||
#ifdef APPIMAGE
|
||||
// Executable is in appdir/bin
|
||||
auto pythonHomeDir = QDir(QCoreApplication::applicationDirPath());
|
||||
pythonHomeDir.cdUp();
|
||||
QString pythonHomeStr = pythonHomeDir.absolutePath();
|
||||
qInfo() << "Setting PYTHONHOME =" << pythonHomeStr << " for AppImage.";
|
||||
pythonHome = Py_DecodeLocale(pythonHomeStr.toLocal8Bit().constData(), nullptr);
|
||||
Py_SetPythonHome(pythonHome);
|
||||
#endif
|
||||
|
||||
PyImport_AppendInittab("cutter", &PyInit_api);
|
||||
PyImport_AppendInittab("cutter_internal", &PyInit_api_internal);
|
||||
Py_Initialize();
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <QProcess>
|
||||
#include <QMap>
|
||||
#include <cwchar>
|
||||
|
||||
class NestedIPyKernel;
|
||||
|
||||
@ -44,6 +45,8 @@ private:
|
||||
QMap<long, NestedIPyKernel *> kernels;
|
||||
long nextKernelId = 1;
|
||||
|
||||
wchar_t *pythonHome = nullptr;
|
||||
|
||||
void initPython();
|
||||
void createCutterJupyterModule();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user