r26658: pidl: Register Python modules.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 4 Jan 2008 03:45:18 +0000 (21:45 -0600)
committerStefan Metzmacher <metze@samba.org>
Thu, 3 Jan 2008 21:51:02 +0000 (15:51 -0600)
source/librpc/config.mk
source/pidl/lib/Parse/Pidl/Samba4/Python.pm
source/scripting/python/modules.c

index 2b2f39b650a0d3eedafb889b66f8c3b06d59feb8..debfbb68692097d6849cb9fda5684bf386d98b60 100644 (file)
@@ -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
index 4110a94dfdaaa24855e76c9eb65af70e773166b9..68e35a85324f3ff2051b71f913ff6a0bcdd09dfd 100644 (file)
@@ -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("}");
index 6094cb49f42423da722569689560ddc0716835dc..55df51d881ec311a7e7945abf586f03d512f02ec 100644 (file)
@@ -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 };