pidl: Remove the need to always specify --client with --python
authorAndrew Bartlett <abartlet@samba.org>
Tue, 25 Jun 2019 03:41:40 +0000 (15:41 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 26 Jun 2019 04:12:33 +0000 (04:12 +0000)
This allows us to avoid generating client code for NDR-only protocols that do
not go over DCE/RPC

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
librpc/idl/wscript_build
pidl/lib/Parse/Pidl/Samba4/Python.pm
pidl/pidl

index 22a52decdfd998b8f85ac76a35c66450570134c9..ed7fca57c6f267f993679a8a076207f09f47ec37 100644 (file)
@@ -92,7 +92,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                     windows_event_ids.idl
                     xattr.idl
                     ''',
-                    options='--header --ndr-parser --python --client',
+                    options='--header --ndr-parser --python',
                     output_dir='../gen_ndr')
 
 bld.SAMBA_PIDL_LIST('PIDL',
index e50c9378862c1f83084c69bf1d3c4773fdafb7dd..97c417adf35c4e8dc2f750f28041c3509c26092e 100644 (file)
@@ -2267,6 +2267,10 @@ sub Parse($$$$$)
 
        $self->{BASENAME} = $basename;
 
+        my $ndr_hdr_include = "";
+       if (defined($ndr_hdr)) {
+               $ndr_hdr_include = "#include \"$ndr_hdr\"";
+       }
     $self->pidl_hdr("
 /* Python wrapper functions auto-generated by pidl */
 #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
@@ -2278,7 +2282,7 @@ sub Parse($$$$$)
 #include \"librpc/rpc/pyrpc.h\"
 #include \"librpc/rpc/pyrpc_util.h\"
 #include \"$hdr\"
-#include \"$ndr_hdr\"
+$ndr_hdr_include
 
 /*
  * These functions are here to ensure they can be optimized out by
index 7883414478179c80eb03505bd7f2fa0528c8f054..06b0f78a4851593fe4ffc1ed5f7a204e9e509472 100755 (executable)
--- a/pidl/pidl
+++ b/pidl/pidl
@@ -712,8 +712,11 @@ sub process_file($)
        if (defined($opt_python)) {
                require Parse::Pidl::Samba4::Python;
                my $generator = new Parse::Pidl::Samba4::Python();
+               if (!defined($opt_client)) {
+                   $c_header = undef;
+               }
                my ($prsr) = $generator->Parse($basename, $ndr,
-                                       "$outputdir/ndr_$basename\_c.h", $h_filename);
+                                              $c_header, $h_filename);
                FileSave("$outputdir/py_$basename.c", $prsr);
        }