From fdbdb02c16aa7a24248f367d0d172c1860d5a1f4 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 24 Jul 2020 00:09:43 +0200 Subject: [PATCH] Make it compatible with python 3.5 --- .../python/pynymealogginghandler.h | 28 +++------- libnymea-core/integrations/python/pyparam.h | 25 ++------- libnymea-core/integrations/python/pything.h | 53 +++--------------- .../integrations/python/pythingactioninfo.h | 54 +++---------------- .../integrations/python/pythingdescriptor.h | 20 ++----- .../python/pythingdiscoveryinfo.h | 51 +++--------------- .../integrations/python/pythingpairinginfo.h | 54 +++---------------- .../integrations/python/pythingsetupinfo.h | 52 +++--------------- .../integrations/pythonintegrationplugin.cpp | 2 +- .../thingmanagerimplementation.cpp | 2 +- libnymea-core/libnymea-core.pro | 10 +++- 11 files changed, 59 insertions(+), 292 deletions(-) diff --git a/libnymea-core/integrations/python/pynymealogginghandler.h b/libnymea-core/integrations/python/pynymealogginghandler.h index 1a5b3f5f..a31d8213 100644 --- a/libnymea-core/integrations/python/pynymealogginghandler.h +++ b/libnymea-core/integrations/python/pynymealogginghandler.h @@ -12,6 +12,7 @@ Q_DECLARE_LOGGING_CATEGORY(dcPythonIntegrations) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" typedef struct { PyObject_HEAD @@ -82,24 +83,7 @@ static PyTypeObject PyNymeaLoggingHandlerType = { "nymea.NymeaLoggingHandler", /* tp_name */ sizeof(PyNymeaLoggingHandler), /* tp_basicsize */ 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "Logging handler for nymea", /* tp_doc */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + (destructor)PyNymeaLoggingHandler_dealloc,/* tp_dealloc */ }; @@ -107,11 +91,11 @@ static void registerNymeaLoggingHandler(PyObject *module) { PyNymeaLoggingHandlerType.tp_new = PyType_GenericNew; - PyNymeaLoggingHandlerType.tp_dealloc = reinterpret_cast(PyNymeaLoggingHandler_dealloc); - PyNymeaLoggingHandlerType.tp_flags = Py_TPFLAGS_DEFAULT; - PyNymeaLoggingHandlerType.tp_doc = "NymeaLoggingHandler class"; - PyNymeaLoggingHandlerType.tp_methods = PyNymeaLoggingHandler_methods; PyNymeaLoggingHandlerType.tp_init = reinterpret_cast(PyNymeaLoggingHandler_init); + PyNymeaLoggingHandlerType.tp_flags = Py_TPFLAGS_DEFAULT; + PyNymeaLoggingHandlerType.tp_methods = PyNymeaLoggingHandler_methods; + PyNymeaLoggingHandlerType.tp_doc = "Logging handler for nymea."; + if (PyType_Ready(&PyNymeaLoggingHandlerType) == 0) { PyModule_AddObject(module, "NymeaLoggingHandler", (PyObject *)&PyNymeaLoggingHandlerType); } diff --git a/libnymea-core/integrations/python/pyparam.h b/libnymea-core/integrations/python/pyparam.h index 87ae8063..8278c343 100644 --- a/libnymea-core/integrations/python/pyparam.h +++ b/libnymea-core/integrations/python/pyparam.h @@ -14,6 +14,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" typedef struct _pyparam { @@ -66,23 +67,7 @@ static PyTypeObject PyParamType = { sizeof(PyParam), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyParam_dealloc,/* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + }; static PyParam* PyParam_fromParam(const Param ¶m) @@ -147,13 +132,11 @@ static ParamList PyParams_ToParamList(PyObject *pyParams) static void registerParamType(PyObject *module) { PyParamType.tp_new = PyType_GenericNew; - PyParamType.tp_basicsize = sizeof(PyParam); - PyParamType.tp_dealloc=(destructor) PyParam_dealloc; + PyParamType.tp_init = reinterpret_cast(PyParam_init); PyParamType.tp_flags = Py_TPFLAGS_DEFAULT; - PyParamType.tp_doc = "Param class"; PyParamType.tp_methods = PyParam_methods; PyParamType.tp_members = PyParam_members; - PyParamType.tp_init = reinterpret_cast(PyParam_init); + PyParamType.tp_doc = "Param class"; if (PyType_Ready(&PyParamType) < 0) { return; diff --git a/libnymea-core/integrations/python/pything.h b/libnymea-core/integrations/python/pything.h index 94325dd6..1678e993 100644 --- a/libnymea-core/integrations/python/pything.h +++ b/libnymea-core/integrations/python/pything.h @@ -16,6 +16,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Note: * When using this, make sure to call PyThing_setThing() while holding the GIL to initialize @@ -362,55 +363,17 @@ static PyTypeObject PyThingType = { sizeof(PyThing), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThing_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "Thing", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PyThing_methods, /* tp_methods */ - PyThing_members, /* tp_members */ - PyThing_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - (newfunc)PyThing_new, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ - 0, /* tp_finalize */ - 0, /* tp_vectorcall */ - 0, /* tp_print DEPRECATED*/ }; static void registerThingType(PyObject *module) { + PyThingType.tp_new = (newfunc)PyThing_new; + PyThingType.tp_flags = Py_TPFLAGS_DEFAULT; + PyThingType.tp_methods = PyThing_methods; + PyThingType.tp_members = PyThing_members; + PyThingType.tp_getset = PyThing_getset; + PyThingType.tp_doc = "The Thing class represents a thing in nymea."; + if (PyType_Ready(&PyThingType) < 0) { return; } diff --git a/libnymea-core/integrations/python/pythingactioninfo.h b/libnymea-core/integrations/python/pythingactioninfo.h index d29c4e4e..7c62a421 100644 --- a/libnymea-core/integrations/python/pythingactioninfo.h +++ b/libnymea-core/integrations/python/pythingactioninfo.h @@ -11,6 +11,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Note: * @@ -103,55 +104,16 @@ static PyTypeObject PyThingActionInfoType = { sizeof(PyThingActionInfo), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThingActionInfo_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "ThingActionInfo", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PyThingActionInfo_methods, /* tp_methods */ - PyThingActionInfo_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - (newfunc)PyThingActionInfo_new, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ - 0, /* tp_finalize */ - 0, /* tp_vectorcall */ - 0, /* tp_print DEPRECATED*/ }; static void registerThingActionInfoType(PyObject *module) { + PyThingActionInfoType.tp_new = (newfunc)PyThingActionInfo_new; + PyThingActionInfoType.tp_flags = Py_TPFLAGS_DEFAULT; + PyThingActionInfoType.tp_methods = PyThingActionInfo_methods; + PyThingActionInfoType.tp_members = PyThingActionInfo_members; + PyThingActionInfoType.tp_doc = "The ThingActionInfo is used to dispatch actions to things"; + if (PyType_Ready(&PyThingActionInfoType) < 0) { return; } @@ -159,8 +121,6 @@ static void registerThingActionInfoType(PyObject *module) } - - #pragma GCC diagnostic pop #endif // PYTHINGACTIONINFO_H diff --git a/libnymea-core/integrations/python/pythingdescriptor.h b/libnymea-core/integrations/python/pythingdescriptor.h index f1d0ba6e..e27d0440 100644 --- a/libnymea-core/integrations/python/pythingdescriptor.h +++ b/libnymea-core/integrations/python/pythingdescriptor.h @@ -10,6 +10,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" typedef struct { @@ -80,23 +81,6 @@ static PyTypeObject PyThingDescriptorType = { sizeof(PyThingDescriptor), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThingDescriptor_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "ThingDescriptor", /* tp_doc */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; @@ -106,6 +90,8 @@ static void registerThingDescriptorType(PyObject *module) PyThingDescriptorType.tp_new = PyType_GenericNew; PyThingDescriptorType.tp_members = PyThingDescriptor_members; PyThingDescriptorType.tp_init = reinterpret_cast(PyThingDescriptor_init); + PyThingDescriptorType.tp_doc = "ThingDescriptors are used to inform the system about things that may be added."; + PyThingDescriptorType.tp_flags = Py_TPFLAGS_DEFAULT; if (PyType_Ready(&PyThingDescriptorType) < 0) { return; diff --git a/libnymea-core/integrations/python/pythingdiscoveryinfo.h b/libnymea-core/integrations/python/pythingdiscoveryinfo.h index cfacfe53..2b6a4e56 100644 --- a/libnymea-core/integrations/python/pythingdiscoveryinfo.h +++ b/libnymea-core/integrations/python/pythingdiscoveryinfo.h @@ -17,6 +17,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Note: @@ -148,57 +149,17 @@ static PyTypeObject PyThingDiscoveryInfoType = { sizeof(PyThingDiscoveryInfo), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThingDiscoveryInfo_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "ThingDiscoveryInfo", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PyThingDiscoveryInfo_methods, /* tp_methods */ - PyThingDiscoveryInfo_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - (newfunc)PyThingDiscoveryInfo_new, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ - 0, /* tp_finalize */ - 0, /* tp_vectorcall */ - 0, /* tp_print DEPRECATED*/ }; static void registerThingDiscoveryInfoType(PyObject *module) { + PyThingDiscoveryInfoType.tp_new = (newfunc)PyThingDiscoveryInfo_new; + PyThingDiscoveryInfoType.tp_flags = Py_TPFLAGS_DEFAULT; + PyThingDiscoveryInfoType.tp_methods = PyThingDiscoveryInfo_methods; + PyThingDiscoveryInfoType.tp_members = PyThingDiscoveryInfo_members; + PyThingDiscoveryInfoType.tp_doc = "The ThingDiscoveryInfo is used to perform discoveries of things."; if (PyType_Ready(&PyThingDiscoveryInfoType) < 0) { return; diff --git a/libnymea-core/integrations/python/pythingpairinginfo.h b/libnymea-core/integrations/python/pythingpairinginfo.h index 6194a4ea..7a9a8071 100644 --- a/libnymea-core/integrations/python/pythingpairinginfo.h +++ b/libnymea-core/integrations/python/pythingpairinginfo.h @@ -16,6 +16,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Note: * When using this, make sure to call PyThingPairingInfo_setInfo() while holding the GIL to initialize @@ -122,57 +123,16 @@ static PyTypeObject PyThingPairingInfoType = { sizeof(PyThingPairingInfo), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThingPairingInfo_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "ThingPairingInfo", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PyThingPairingInfo_methods, /* tp_methods */ - PyThingPairingInfo_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)PyThingPairingInfo_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ - 0, /* tp_finalize */ - 0, /* tp_vectorcall */ - 0, /* tp_print DEPRECATED*/ }; - - static void registerThingPairingInfoType(PyObject *module) { + PyThingPairingInfoType.tp_new = PyType_GenericNew; + PyThingPairingInfoType.tp_init = (initproc)PyThingPairingInfo_init; + PyThingPairingInfoType.tp_flags = Py_TPFLAGS_DEFAULT; + PyThingPairingInfoType.tp_methods = PyThingPairingInfo_methods; + PyThingPairingInfoType.tp_members = PyThingPairingInfo_members; + PyThingPairingInfoType.tp_doc = "The ThingPairingInfo is used to aithenticate with a thing."; if (PyType_Ready(&PyThingPairingInfoType) < 0) { return; diff --git a/libnymea-core/integrations/python/pythingsetupinfo.h b/libnymea-core/integrations/python/pythingsetupinfo.h index 83199546..bad30f43 100644 --- a/libnymea-core/integrations/python/pythingsetupinfo.h +++ b/libnymea-core/integrations/python/pythingsetupinfo.h @@ -11,6 +11,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Note: * @@ -100,55 +101,16 @@ static PyTypeObject PyThingSetupInfoType = { sizeof(PyThingSetupInfo), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyThingSetupInfo_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "ThingSetupInfo", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - PyThingSetupInfo_methods, /* tp_methods */ - PyThingSetupInfo_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - (newfunc)PyThingSetupInfo_new, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ - 0, /* tp_finalize */ - 0, /* tp_vectorcall */ - 0, /* tp_print DEPRECATED*/ }; static void registerThingSetupInfoType(PyObject *module) { + PyThingSetupInfoType.tp_new = (newfunc)PyThingSetupInfo_new; + PyThingSetupInfoType.tp_flags = Py_TPFLAGS_DEFAULT; + PyThingSetupInfoType.tp_methods = PyThingSetupInfo_methods; + PyThingSetupInfoType.tp_members = PyThingSetupInfo_members; + PyThingSetupInfoType.tp_doc = "The ThingSetupInfo is used to set up a thing."; + if (PyType_Ready(&PyThingSetupInfoType) < 0) { return; } diff --git a/libnymea-core/integrations/pythonintegrationplugin.cpp b/libnymea-core/integrations/pythonintegrationplugin.cpp index b559f3fb..abe434e0 100644 --- a/libnymea-core/integrations/pythonintegrationplugin.cpp +++ b/libnymea-core/integrations/pythonintegrationplugin.cpp @@ -233,7 +233,7 @@ void PythonIntegrationPlugin::initPython() void PythonIntegrationPlugin::deinitPython() { PyEval_RestoreThread(s_mainThreadState); - Py_FinalizeEx(); + Py_Finalize(); } bool PythonIntegrationPlugin::loadScript(const QString &scriptFile) diff --git a/libnymea-core/integrations/thingmanagerimplementation.cpp b/libnymea-core/integrations/thingmanagerimplementation.cpp index e21e99f1..bd4b5a65 100644 --- a/libnymea-core/integrations/thingmanagerimplementation.cpp +++ b/libnymea-core/integrations/thingmanagerimplementation.cpp @@ -1267,7 +1267,7 @@ void ThingManagerImplementation::loadPlugins() delete p; } #else - qCWarning(dcThingManager()) << "Not loading JS plugin as JS plugin support is not included in this nymea instance." + qCWarning(dcThingManager()) << "Not loading JS plugin as JS plugin support is not included in this nymea instance."; #endif } else if (entry.startsWith("integrationplugin") && entry.endsWith(".py")) { PythonIntegrationPlugin *p = new PythonIntegrationPlugin(this); diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index c7f488cc..fc380368 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -8,7 +8,15 @@ INCLUDEPATH += $$top_srcdir/libnymea $$top_builddir LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto CONFIG += link_pkgconfig -PKGCONFIG += nymea-mqtt nymea-networkmanager python3-embed +PKGCONFIG += nymea-mqtt nymea-networkmanager + +packagesExist(python3-embed) { + PKGCONFIG += python3-embed +} else:packagesExist(python-3.5) { + PKGCONFIG += python-3.5 +} else { + error("Python development package not found.") +} target.path = $$[QT_INSTALL_LIBS] INSTALLS += target