aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python
diff options
context:
space:
mode:
authorTobias Mueller <[email protected]>2016-12-20 17:00:36 +0000
committerJustus Winter <[email protected]>2017-02-14 10:19:12 +0000
commitd184dbbba8987d9f387feb25791ed891e108dabc (patch)
treef08d141b2d6659da9f9876c41c1649ed6ca99d43 /lang/python
parentpython: Use one copy of the source tree per Python version. (diff)
downloadgpgme-d184dbbba8987d9f387feb25791ed891e108dabc.tar.gz
gpgme-d184dbbba8987d9f387feb25791ed891e108dabc.zip
python: Conditionally provide py3 argument to SWIG
* lang/python/setup.py.in: Only call with -py3 when we run under python3 or higher. -- If we ever remove the -builtin flag and leave the the -py3 flag, SWIG will generate Python code which will be incompatible with Python 2, 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 <[email protected]>
Diffstat (limited to 'lang/python')
-rwxr-xr-xlang/python/setup.py.in5
1 files changed, 3 insertions, 2 deletions
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 9669c285..c7f981ae 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', '-builtin',
+ '-outdir', 'gpg'] + py3 + extra_swig_opts,
include_dirs = include_dirs,
define_macros = define_macros,
library_dirs = library_dirs,