diff options
author | Lumir Balhar <lbalhar@redhat.com> | 2018-01-30 18:47:32 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-02-15 00:18:28 +0100 |
commit | 7ee74f66a1715b2c88165f025ebc3b661f15c75d (patch) | |
tree | 47e1ee3dd9a706e2a60cda4291758a9cb30a97c1 /source4/dns_server | |
parent | a45e70bf47cb4b48f69a237298e143f574bf58bb (diff) | |
download | samba-7ee74f66a1715b2c88165f025ebc3b661f15c75d.tar.gz |
python: Port dsdb_dns module to Python 3 compatible form.
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dns_server')
-rw-r--r-- | source4/dns_server/pydns.c | 19 | ||||
-rw-r--r-- | source4/dns_server/wscript_build | 8 |
2 files changed, 20 insertions, 7 deletions
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 <Python.h> +#include "python/py3compat.h" #include "includes.h" #include <pyldb.h> #include <pytalloc.h> @@ -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') |