mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 00:35:05 +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 <QDebug>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "JupyterConnection.h"
|
#include "JupyterConnection.h"
|
||||||
#include "NestedIPyKernel.h"
|
#include "NestedIPyKernel.h"
|
||||||
@ -39,11 +41,26 @@ JupyterConnection::~JupyterConnection()
|
|||||||
|
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pythonHome)
|
||||||
|
{
|
||||||
|
PyMem_RawFree(pythonHome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JupyterConnection::initPython()
|
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", &PyInit_api);
|
||||||
PyImport_AppendInittab("cutter_internal", &PyInit_api_internal);
|
PyImport_AppendInittab("cutter_internal", &PyInit_api_internal);
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <cwchar>
|
||||||
|
|
||||||
class NestedIPyKernel;
|
class NestedIPyKernel;
|
||||||
|
|
||||||
@ -44,6 +45,8 @@ private:
|
|||||||
QMap<long, NestedIPyKernel *> kernels;
|
QMap<long, NestedIPyKernel *> kernels;
|
||||||
long nextKernelId = 1;
|
long nextKernelId = 1;
|
||||||
|
|
||||||
|
wchar_t *pythonHome = nullptr;
|
||||||
|
|
||||||
void initPython();
|
void initPython();
|
||||||
void createCutterJupyterModule();
|
void createCutterJupyterModule();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user