From 1548d8d2be2a1012549f626d504070272bb51c9e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 21:45:18 -0600 Subject: r26658: pidl: Register Python modules. (This used to be commit f47044aacc8eb6df856524744ab87bee997bae6d) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source4/pidl/lib') 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("}"); -- cgit