From: Lumir Balhar Date: Tue, 30 Jan 2018 17:47:32 +0000 (+0100) Subject: python: Port dsdb_dns module to Python 3 compatible form. X-Git-Tag: tevent-0.9.36~104 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ee74f66a1715b2c88165f025ebc3b661f15c75d;p=thirdparty%2Fsamba.git python: Port dsdb_dns module to Python 3 compatible form. Signed-off-by: Lumir Balhar Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dns_server/pydns.c b/source4/dns_server/pydns.c index 63fa80e92b3..a4441ddef56 100644 --- a/source4/dns_server/pydns.c +++ b/source4/dns_server/pydns.c @@ -20,6 +20,7 @@ */ #include +#include "python/py3compat.h" #include "includes.h" #include #include @@ -333,14 +334,22 @@ static PyMethodDef py_dsdb_dns_methods[] = { { NULL } }; -void initdsdb_dns(void); +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + .m_name = "dsdb_dns", + .m_doc = "Python bindings for the DNS objects in the directory service databases.", + .m_size = -1, + .m_methods = py_dsdb_dns_methods, +}; -void initdsdb_dns(void) +MODULE_INIT_FUNC(dsdb_dns) { PyObject *m; - m = Py_InitModule3("dsdb_dns", py_dsdb_dns_methods, - "Python bindings for the DNS objects in the directory service databases."); + m = PyModule_Create(&moduledef); + if (m == NULL) - return; + return NULL; + + return m; } diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build index 47701e0f293..c24f45584a4 100644 --- a/source4/dns_server/wscript_build +++ b/source4/dns_server/wscript_build @@ -65,8 +65,12 @@ bld.SAMBA_LIBRARY('dlz_bind9_for_torture', deps='samba-hostconfig samdb-common gensec popt dnsserver_common', enabled=bld.AD_DC_BUILD_IS_ENABLED()) +for env in bld.gen_python_environments(): + pyldb_util = bld.pyembed_libname('pyldb-util') + pyrpc_util = bld.pyembed_libname('pyrpc_util') + pytalloc_util = bld.pyembed_libname('pytalloc-util') -bld.SAMBA_PYTHON('python_dsdb_dns', + bld.SAMBA_PYTHON('python_dsdb_dns', source='pydns.c', - deps='samdb pyldb-util pyrpc_util dnsserver_common pytalloc-util', + deps='samdb %s %s dnsserver_common %s' % (pyldb_util, pyrpc_util, pytalloc_util), realname='samba/dsdb_dns.so')