Make it compatible with python 3.5
This commit is contained in:
parent
be01d4c802
commit
fdbdb02c16
@ -12,6 +12,7 @@ Q_DECLARE_LOGGING_CATEGORY(dcPythonIntegrations)
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
@ -82,24 +83,7 @@ static PyTypeObject PyNymeaLoggingHandlerType = {
|
|||||||
"nymea.NymeaLoggingHandler", /* tp_name */
|
"nymea.NymeaLoggingHandler", /* tp_name */
|
||||||
sizeof(PyNymeaLoggingHandler), /* tp_basicsize */
|
sizeof(PyNymeaLoggingHandler), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
0, /* tp_dealloc */
|
(destructor)PyNymeaLoggingHandler_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 */
|
|
||||||
"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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -107,11 +91,11 @@ static void registerNymeaLoggingHandler(PyObject *module)
|
|||||||
{
|
{
|
||||||
|
|
||||||
PyNymeaLoggingHandlerType.tp_new = PyType_GenericNew;
|
PyNymeaLoggingHandlerType.tp_new = PyType_GenericNew;
|
||||||
PyNymeaLoggingHandlerType.tp_dealloc = reinterpret_cast<destructor>(PyNymeaLoggingHandler_dealloc);
|
|
||||||
PyNymeaLoggingHandlerType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
||||||
PyNymeaLoggingHandlerType.tp_doc = "NymeaLoggingHandler class";
|
|
||||||
PyNymeaLoggingHandlerType.tp_methods = PyNymeaLoggingHandler_methods;
|
|
||||||
PyNymeaLoggingHandlerType.tp_init = reinterpret_cast<initproc>(PyNymeaLoggingHandler_init);
|
PyNymeaLoggingHandlerType.tp_init = reinterpret_cast<initproc>(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) {
|
if (PyType_Ready(&PyNymeaLoggingHandlerType) == 0) {
|
||||||
PyModule_AddObject(module, "NymeaLoggingHandler", (PyObject *)&PyNymeaLoggingHandlerType);
|
PyModule_AddObject(module, "NymeaLoggingHandler", (PyObject *)&PyNymeaLoggingHandlerType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _pyparam {
|
typedef struct _pyparam {
|
||||||
@ -66,23 +67,7 @@ static PyTypeObject PyParamType = {
|
|||||||
sizeof(PyParam), /* tp_basicsize */
|
sizeof(PyParam), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyParam_dealloc,/* tp_dealloc */
|
(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)
|
static PyParam* PyParam_fromParam(const Param ¶m)
|
||||||
@ -147,13 +132,11 @@ static ParamList PyParams_ToParamList(PyObject *pyParams)
|
|||||||
static void registerParamType(PyObject *module)
|
static void registerParamType(PyObject *module)
|
||||||
{
|
{
|
||||||
PyParamType.tp_new = PyType_GenericNew;
|
PyParamType.tp_new = PyType_GenericNew;
|
||||||
PyParamType.tp_basicsize = sizeof(PyParam);
|
PyParamType.tp_init = reinterpret_cast<initproc>(PyParam_init);
|
||||||
PyParamType.tp_dealloc=(destructor) PyParam_dealloc;
|
|
||||||
PyParamType.tp_flags = Py_TPFLAGS_DEFAULT;
|
PyParamType.tp_flags = Py_TPFLAGS_DEFAULT;
|
||||||
PyParamType.tp_doc = "Param class";
|
|
||||||
PyParamType.tp_methods = PyParam_methods;
|
PyParamType.tp_methods = PyParam_methods;
|
||||||
PyParamType.tp_members = PyParam_members;
|
PyParamType.tp_members = PyParam_members;
|
||||||
PyParamType.tp_init = reinterpret_cast<initproc>(PyParam_init);
|
PyParamType.tp_doc = "Param class";
|
||||||
|
|
||||||
if (PyType_Ready(&PyParamType) < 0) {
|
if (PyType_Ready(&PyParamType) < 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
* When using this, make sure to call PyThing_setThing() while holding the GIL to initialize
|
* 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 */
|
sizeof(PyThing), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThing_dealloc, /* tp_dealloc */
|
(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)
|
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) {
|
if (PyType_Ready(&PyThingType) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
*
|
*
|
||||||
@ -103,55 +104,16 @@ static PyTypeObject PyThingActionInfoType = {
|
|||||||
sizeof(PyThingActionInfo), /* tp_basicsize */
|
sizeof(PyThingActionInfo), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThingActionInfo_dealloc, /* tp_dealloc */
|
(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)
|
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) {
|
if (PyType_Ready(&PyThingActionInfoType) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,8 +121,6 @@ static void registerThingActionInfoType(PyObject *module)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#endif // PYTHINGACTIONINFO_H
|
#endif // PYTHINGACTIONINFO_H
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -80,23 +81,6 @@ static PyTypeObject PyThingDescriptorType = {
|
|||||||
sizeof(PyThingDescriptor), /* tp_basicsize */
|
sizeof(PyThingDescriptor), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThingDescriptor_dealloc, /* tp_dealloc */
|
(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_new = PyType_GenericNew;
|
||||||
PyThingDescriptorType.tp_members = PyThingDescriptor_members;
|
PyThingDescriptorType.tp_members = PyThingDescriptor_members;
|
||||||
PyThingDescriptorType.tp_init = reinterpret_cast<initproc>(PyThingDescriptor_init);
|
PyThingDescriptorType.tp_init = reinterpret_cast<initproc>(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) {
|
if (PyType_Ready(&PyThingDescriptorType) < 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
@ -148,57 +149,17 @@ static PyTypeObject PyThingDiscoveryInfoType = {
|
|||||||
sizeof(PyThingDiscoveryInfo), /* tp_basicsize */
|
sizeof(PyThingDiscoveryInfo), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThingDiscoveryInfo_dealloc, /* tp_dealloc */
|
(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)
|
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) {
|
if (PyType_Ready(&PyThingDiscoveryInfoType) < 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
* When using this, make sure to call PyThingPairingInfo_setInfo() while holding the GIL to initialize
|
* 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 */
|
sizeof(PyThingPairingInfo), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThingPairingInfo_dealloc, /* tp_dealloc */
|
(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)
|
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) {
|
if (PyType_Ready(&PyThingPairingInfoType) < 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
*
|
*
|
||||||
@ -100,55 +101,16 @@ static PyTypeObject PyThingSetupInfoType = {
|
|||||||
sizeof(PyThingSetupInfo), /* tp_basicsize */
|
sizeof(PyThingSetupInfo), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
(destructor)PyThingSetupInfo_dealloc, /* tp_dealloc */
|
(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)
|
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) {
|
if (PyType_Ready(&PyThingSetupInfoType) < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -233,7 +233,7 @@ void PythonIntegrationPlugin::initPython()
|
|||||||
void PythonIntegrationPlugin::deinitPython()
|
void PythonIntegrationPlugin::deinitPython()
|
||||||
{
|
{
|
||||||
PyEval_RestoreThread(s_mainThreadState);
|
PyEval_RestoreThread(s_mainThreadState);
|
||||||
Py_FinalizeEx();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PythonIntegrationPlugin::loadScript(const QString &scriptFile)
|
bool PythonIntegrationPlugin::loadScript(const QString &scriptFile)
|
||||||
|
|||||||
@ -1267,7 +1267,7 @@ void ThingManagerImplementation::loadPlugins()
|
|||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
#else
|
#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
|
#endif
|
||||||
} else if (entry.startsWith("integrationplugin") && entry.endsWith(".py")) {
|
} else if (entry.startsWith("integrationplugin") && entry.endsWith(".py")) {
|
||||||
PythonIntegrationPlugin *p = new PythonIntegrationPlugin(this);
|
PythonIntegrationPlugin *p = new PythonIntegrationPlugin(this);
|
||||||
|
|||||||
@ -8,7 +8,15 @@ INCLUDEPATH += $$top_srcdir/libnymea $$top_builddir
|
|||||||
LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto
|
LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto
|
||||||
|
|
||||||
CONFIG += link_pkgconfig
|
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]
|
target.path = $$[QT_INSTALL_LIBS]
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|||||||
Reference in New Issue
Block a user