[PATCH] python: Remove -builtin flag for SWIG bindings.
Tobias Mueller
muelli at cryptobitch.de
Tue Nov 29 22:51:07 CET 2016
* lang/python/setup.py.in: changed the swig call
--
The motivation is to be able to program __repr__
functions more easily, i.e. in Python rather than C.
The -builtin flag prevents that, though, because Python code
will not be compiled.
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.
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,
include_dirs = include_dirs,
define_macros = define_macros,
library_dirs = library_dirs,
--
2.7.4
More information about the Gnupg-devel
mailing list