From 9de1c96ac3cf6fa126325002b61a1b606037ca88 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Wed, 17 Oct 2018 22:23:59 -0400 Subject: [PATCH] python: do not export HAVE_CXX11 definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lang/python/gpgme.i: ignore HAVE_CXX11 in SWIG interface -- If there are two distinct builds (a) and (b) of gpgme which both build python bindings, and build (a) also happens to build the C++ bindings, then the generated gpg/gpgme.py file from build (a) will not be usable with the .so generated in build (b), despite them being exactly the same, and having nothing to do with C++. In particular, it will fail with: ----------- File "…/gpg/__init__.py", line 99, in from . import core File "…/gpg/core.py", line 10, in from . import gpgme File "…/gpg/gpgme.py", line 152, in HAVE_CXX11 = _gpgme.HAVE_CXX11 AttributeError: module 'gpg._gpgme' has no attribute 'HAVE_CXX11' ----------- By asking SWIG to ignore this definition, we stabilize the generated .py and the .so, ensuring that they are more cleanly interoperable. --- lang/python/gpgme.i | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i index f3d14a7d..87371af8 100644 --- a/lang/python/gpgme.i +++ b/lang/python/gpgme.i @@ -21,6 +21,10 @@ %include "cpointer.i" %include "cstring.i" +/* no need to record whether GPGME's c++ bindings were built + concurrently with the python bindings */ +%ignore HAVE_CXX11; + %{ /* We use public symbols (eg. "_obsolete_class") which are marked as * deprecated but we need to keep them. Silence the warning. */