summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-03 21:45:18 -0600
committerStefan Metzmacher <metze@samba.org>2008-01-03 15:51:02 -0600
commit1548d8d2be2a1012549f626d504070272bb51c9e (patch)
tree38b8c5043760435d8b18d623e8c480839a775f23
parent0dbdfc2218c801b973a34fc810e5bb1b4509dd3c (diff)
downloadsamba-1548d8d2be2a1012549f626d504070272bb51c9e.tar.gz
samba-1548d8d2be2a1012549f626d504070272bb51c9e.tar.bz2
samba-1548d8d2be2a1012549f626d504070272bb51c9e.zip
r26658: pidl: Register Python modules.
(This used to be commit f47044aacc8eb6df856524744ab87bee997bae6d)
-rw-r--r--source4/librpc/config.mk4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm12
-rw-r--r--source4/scripting/python/modules.c1
3 files changed, 16 insertions, 1 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 2b2f39b650..debfbb6869 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -594,3 +594,7 @@ PRIVATE_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC
[PYTHON::swig_dcerpc]
SWIG_FILE = rpc/dcerpc.i
PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-CONFIG dcerpc_samr RPC_NDR_LSA DYNCONFIG
+
+[PYTHON::python_echo]
+OBJ_FILES = gen_ndr/py_echo.o
+PRIVATE_DEPENDENCIES = NDR_ECHO
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 4110a94dfd..68e35a8532 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -54,7 +54,7 @@ sub Parse($$$$)
my($self,$basename,$ndr,$hdr) = @_;
my $py_hdr = $hdr;
- $py_hdr =~ s/^/py_/g;
+ $py_hdr =~ s/ndr_([^\/]+)$/py_$1/g;
$self->pidl_hdr("/* header auto-generated by pidl */\n\n");
@@ -66,10 +66,20 @@ sub Parse($$$$)
#include \"$py_hdr\"
");
+
+ $self->pidl("static PyMethodDef $basename\_methods[] = {");
+ $self->indent;
+ $self->pidl("{ NULL, NULL, 0, NULL }");
+ $self->deindent;
+ $self->pidl("};");
+
+ $self->pidl("");
$self->pidl("void init$basename(void)");
$self->pidl("{");
$self->indent;
+ $self->pidl("PyObject *m;");
+ $self->pidl("m = Py_InitModule((char *)\"$basename\", $basename\_methods);");
# FIXME
$self->deindent;
$self->pidl("}");
diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c
index 6094cb49f4..55df51d881 100644
--- a/source4/scripting/python/modules.c
+++ b/source4/scripting/python/modules.c
@@ -34,6 +34,7 @@ extern void init_dcerpc(void);
extern void init_events(void);
extern void inituuid(void);
extern void init_net(void);
+extern void initecho(void);
static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES };