python: do not export HAVE_CXX11 definition

* 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 <module>
    from . import core
  File "…/gpg/core.py", line 10, in <module>
    from . import gpgme
  File "…/gpg/gpgme.py", line 152, in <module>
    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.
This commit is contained in:
Daniel Kahn Gillmor 2018-10-17 22:23:59 -04:00
parent 12b0b5c894
commit 9de1c96ac3

View File

@ -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. */