From: Noel Power Date: Mon, 5 Feb 2018 11:10:46 +0000 (+0000) Subject: python3 port for smbd module X-Git-Tag: talloc-2.1.13~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53e76ed2ff1f9a82eb5260c10e86c890d893eb2a;p=thirdparty%2Fsamba.git python3 port for smbd module Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index be30b866e20..daaf95cb665 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -25,6 +25,7 @@ #include #include "includes.h" +#include "python/py3compat.h" #include "smbd/smbd.h" #include "libcli/util/pyerrors.h" #include "librpc/rpc/pyrpc_util.h" @@ -739,13 +740,19 @@ static PyMethodDef py_smbd_methods[] = { }; void initsmbd(void); -void initsmbd(void) -{ - PyObject *m; - m = Py_InitModule3("smbd", py_smbd_methods, - "Python bindings for the smbd file server."); - if (m == NULL) - return; +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + .m_name = "smbd", + .m_doc = "Python bindings for the smbd file server.", + .m_size = -1, + .m_methods = py_smbd_methods, +}; + +MODULE_INIT_FUNC(smbd) +{ + PyObject *m = NULL; + m = PyModule_Create(&moduledef); + return m; } diff --git a/source3/wscript_build b/source3/wscript_build index 254738e69ea..f0eb23cc3f7 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1296,7 +1296,9 @@ bld.SAMBA3_BINARY('vlp', ''', install=False) -bld.SAMBA3_PYTHON('pysmbd', + +for env in bld.gen_python_environments(): + bld.SAMBA3_PYTHON('pysmbd', source='smbd/pysmbd.c', deps='smbd_base pyrpc_util pytalloc-util', realname='samba/samba3/smbd.so'