[Pkg-gnupg-commit] [gpgme] 62/132: python: Conditionally provide py3 argument to SWIG

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 26 01:01:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit d184dbbba8987d9f387feb25791ed891e108dabc
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Dec 20 18:00:36 2016 +0100

    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 <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..c7f981a 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,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list