mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
python: Port samba.messaging module to Python 3 compatible form.
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
c3a1348371
commit
806c1bcacd
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include "python/py3compat.h"
|
||||
#include "includes.h"
|
||||
#include "python/modules.h"
|
||||
#include "libcli/util/pyerrors.h"
|
||||
@ -36,7 +37,6 @@
|
||||
#include <pytalloc.h>
|
||||
#include "messaging_internal.h"
|
||||
|
||||
void initmessaging(void);
|
||||
|
||||
extern PyTypeObject imessaging_Type;
|
||||
|
||||
@ -493,7 +493,7 @@ static PyGetSetDef py_imessaging_getset[] = {
|
||||
|
||||
|
||||
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,
|
||||
@ -505,19 +505,29 @@ PyTypeObject imessaging_Type = {
|
||||
"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;
|
||||
}
|
||||
|
@ -13,9 +13,13 @@ bld.SAMBA_LIBRARY('MESSAGING',
|
||||
private_library=True
|
||||
)
|
||||
|
||||
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'
|
||||
)
|
||||
|
||||
|
@ -338,7 +338,7 @@ for env in bld.gen_python_environments():
|
||||
|
||||
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'
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user