*/
#include <Python.h>
+#include "python/py3compat.h"
#include "includes.h"
#include "python/modules.h"
#include "libcli/util/pyerrors.h"
#include <pytalloc.h>
#include "messaging_internal.h"
-void initmessaging(void);
extern PyTypeObject imessaging_Type;
PyTypeObject imessaging_Type = {
- PyObject_HEAD_INIT(NULL) 0,
+ PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "messaging.Messaging",
.tp_basicsize = sizeof(imessaging_Object),
.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
"Create a new object that can be used to communicate with the peers in the specified messaging path.\n"
};
-void initmessaging(void)
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ .m_name = "messaging",
+ .m_doc = "Internal RPC",
+ .m_size = -1,
+ .m_methods = NULL,
+};
+
+MODULE_INIT_FUNC(messaging)
{
PyObject *mod;
if (PyType_Ready(&imessaging_Type) < 0)
- return;
+ return NULL;
- mod = Py_InitModule3("messaging", NULL, "Internal RPC");
+ mod = PyModule_Create(&moduledef);
if (mod == NULL)
- return;
+ return NULL;
Py_INCREF((PyObject *)&imessaging_Type);
PyModule_AddObject(mod, "Messaging", (PyObject *)&imessaging_Type);
PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT", PyInt_FromLong(IRPC_CALL_TIMEOUT));
PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT_INF", PyInt_FromLong(IRPC_CALL_TIMEOUT_INF));
+
+ return mod;
}
private_library=True
)
-bld.SAMBA_PYTHON('python_messaging',
- source='pymessaging.c',
- deps='MESSAGING events pyparam_util pytalloc-util',
- realname='samba/messaging.so'
- )
+for env in bld.gen_python_environments():
+
+ pyparam_util = bld.pyembed_libname('pyparam_util')
+ pytalloc_util = bld.pyembed_libname('pytalloc-util')
+ bld.SAMBA_PYTHON('python_messaging',
+ source='pymessaging.c',
+ deps='MESSAGING events pyparam_util pytalloc-util',
+ realname='samba/messaging.so'
+ )
bld.SAMBA_PYTHON('python_irpc',
source='gen_ndr/py_irpc.c',
- deps='RPC_NDR_IRPC pytalloc-util pyrpc_util',
+ deps='RPC_NDR_IRPC %s %s' % (pytalloc_util, pyrpc_util),
realname='samba/dcerpc/irpc.so'
)