mirror of https://github.com/Icinga/icinga2.git
Python: Fix --disable-shared.
This commit is contained in:
parent
d0f263abb1
commit
7cb67afaae
|
@ -31,8 +31,14 @@ PyMethodDef PythonLanguage::m_NativeMethodDef[] = {
|
|||
};
|
||||
|
||||
PythonLanguage::PythonLanguage(void)
|
||||
: ScriptLanguage()
|
||||
: ScriptLanguage(), m_Initialized(false)
|
||||
{ }
|
||||
|
||||
void PythonLanguage::InitializeOnce(void)
|
||||
{
|
||||
if (m_Initialized)
|
||||
return;
|
||||
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
|
||||
|
@ -59,6 +65,8 @@ PythonLanguage::PythonLanguage(void)
|
|||
|
||||
ScriptFunction::OnRegistered.connect(boost::bind(&PythonLanguage::RegisterNativeFunction, this, _1, _2));
|
||||
ScriptFunction::OnUnregistered.connect(boost::bind(&PythonLanguage::UnregisterNativeFunction, this, _1));
|
||||
|
||||
m_Initialized = true;
|
||||
}
|
||||
|
||||
PythonLanguage::~PythonLanguage(void)
|
||||
|
@ -70,6 +78,8 @@ PythonLanguage::~PythonLanguage(void)
|
|||
|
||||
ScriptInterpreter::Ptr PythonLanguage::CreateInterpreter(const Script::Ptr& script)
|
||||
{
|
||||
InitializeOnce();
|
||||
|
||||
return boost::make_shared<PythonInterpreter>(GetSelf(), script);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,9 @@ public:
|
|||
static Value MarshalFromPython(PyObject *value);
|
||||
|
||||
String ExceptionInfoToString(PyObject *type, PyObject *exc, PyObject *tb) const;
|
||||
|
||||
private:
|
||||
bool m_Initialized;
|
||||
PyThreadState *m_MainThreadState;
|
||||
PyObject *m_NativeModule;
|
||||
PyObject *m_TracebackModule;
|
||||
|
@ -63,6 +65,8 @@ private:
|
|||
static PyObject *PyRegisterFunction(PyObject *self, PyObject *args);
|
||||
|
||||
static PyMethodDef m_NativeMethodDef[];
|
||||
|
||||
void InitializeOnce(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue