summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorLumir Balhar <lbalhar@redhat.com>2017-04-20 15:11:58 +0200
committerStefan Metzmacher <metze@samba.org>2017-06-13 22:46:14 +0200
commitba4cabb74f9abf834ee50364fba98ba8c3e9dee3 (patch)
tree8bc9b1c86ad7422008ac77a42927bbc0ac8a2a33 /python
parentaa74d6edf597c92112553b74d9e3675dfa30ca48 (diff)
downloadsamba-ba4cabb74f9abf834ee50364fba98ba8c3e9dee3.tar.gz
python: Port simple libpython module to Python 3 compatible form
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/modules.c3
-rw-r--r--python/wscript17
2 files changed, 11 insertions, 9 deletions
diff --git a/python/modules.c b/python/modules.c
index 371f0d5a07a..5db3dd348e2 100644
--- a/python/modules.c
+++ b/python/modules.c
@@ -18,13 +18,14 @@
*/
#include <Python.h>
+#include "py3compat.h"
#include "includes.h"
#include "python/modules.h"
#include "dynconfig/dynconfig.h"
static bool PySys_PathPrepend(PyObject *list, const char *path)
{
- PyObject *py_path = PyString_FromString(path);
+ PyObject *py_path = PyStr_FromString(path);
if (py_path == NULL)
return false;
diff --git a/python/wscript b/python/wscript
index 623ca44b005..211fac4de62 100644
--- a/python/wscript
+++ b/python/wscript
@@ -51,17 +51,10 @@ def build(bld):
pyembed=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED())
- bld.SAMBA_SUBSYSTEM('LIBPYTHON',
- source='modules.c',
- public_deps='',
- init_function_sentinel='{NULL,NULL}',
- deps='talloc',
- pyext=True,
- enabled=bld.PYTHON_BUILD_IS_ENABLED())
-
for env in bld.gen_python_environments():
pytalloc_util = bld.pyembed_libname('pytalloc-util')
pyparam_util = bld.pyembed_libname('pyparam_util')
+ libpython = bld.pyembed_libname('LIBPYTHON')
bld.SAMBA_PYTHON('python_glue',
source='pyglue.c',
@@ -73,6 +66,14 @@ def build(bld):
''' % (pyparam_util, pytalloc_util),
realname='samba/_glue.so')
+ bld.SAMBA_SUBSYSTEM(libpython,
+ source='modules.c',
+ public_deps='',
+ init_function_sentinel='{NULL,NULL}',
+ deps='talloc',
+ pyext=True,
+ enabled=bld.PYTHON_BUILD_IS_ENABLED())
+
if bld.PYTHON_BUILD_IS_ENABLED():
for env in bld.gen_python_environments():
# install out various python scripts for use by make test