diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-06-25 15:41:40 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-06-26 04:12:33 +0000 |
commit | 5df815cfd21c33eaa0e38196490066f214356bd3 (patch) | |
tree | 1f4dfb151a2746d2f4d87da1448eb04e91ae2f9a | |
parent | 46bf62dd0c67e90dcbefe7f7a106f1b5927b08f6 (diff) | |
download | samba-5df815cfd21c33eaa0e38196490066f214356bd3.tar.gz |
pidl: Remove the need to always specify --client with --python
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>
-rw-r--r-- | librpc/idl/wscript_build | 2 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 | ||||
-rwxr-xr-x | pidl/pidl | 5 |
3 files changed, 10 insertions, 3 deletions
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 22a52decdfd..ed7fca57c6f 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -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', diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index e50c9378862..97c417adf35 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -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 diff --git a/pidl/pidl b/pidl/pidl index 78834144781..06b0f78a485 100755 --- 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); } |