[PATCH] python: Remove -builtin flag for SWIG bindings.

Justus Winter justus at g10code.com
Wed Dec 7 15:32:52 CET 2016


Tobias Mueller <muelli at cryptobitch.de> writes:

> * lang/python/setup.py.in: changed the swig call

Please use whole sentences when describing a change.  Start with a
capital letter and end in a full stop.

> --
>
> The motivation is to be able to program __repr__
> functions more easily, i.e. in Python rather than C.

Ok.

> The -builtin flag prevents that, though, because Python code
> will not be compiled.

I don't quite understand.  Python being compiled sounds at best
ambiguous.

Can you please provide an example of what this change will allow us to
do?

> The -py3 flag prevents the SWIG bindings to run under python2
> when generated without the -builtin flag, because the py3 flag
> generates python3 code which is incompatible with python2.
>
> So we conditionally generate SWIG bindings with -py3.

Indeed.  That sounds like a good idea in general, independent from the
'-builtin' issue.  Would you be so kind to send a standalone patch?

(This is in general a good idea, because it makes discussing changes,
reasoning about changes, and partial application of patch series much
easier, and git bisect more powerful.)

> Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>
> ---
>  lang/python/setup.py.in | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
> index 9669c28..5b5d5be 100755
> --- a/lang/python/setup.py.in
> +++ b/lang/python/setup.py.in
> @@ -152,9 +152,10 @@ class BuildExtFirstHack(build):
>          self.run_command('build_ext')
>          build.run(self)
>  
> +py3 = [] if sys.version_info.major < 3 else ['-py3']
>  swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
> -                  swig_opts = ['-py3', '-builtin', '-threads',
> -                               '-outdir', 'gpg'] + extra_swig_opts,
> +                  swig_opts = ['-threads',
> +                               '-outdir', 'gpg'] + py3 + extra_swig_opts,

This basically reverts 856bcfe2934237011984fab0bc69800a7c25c34b.  Silly
past-me did not write his reasons for doing that change in the
changelog, but I guess I merely wanted to reduce the amount of wrapping
being done here.  But I'm not opposed to reverting this if it has the
benefits you mentioned.

However, in that commit I also had to adapt another piece of code, and
you didn't revert that chunk.  Could you please investigate this?


Thanks,
Justus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: </pipermail/attachments/20161207/24701ae1/attachment.sig>


More information about the Gnupg-devel mailing list