[Pkg-gnupg-commit] [gpgme] 135/412: python: Make all GnuPG errors available.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu Sep 22 21:26:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gpgme.
commit 7bc9cc717e428f48d4b27016f44c9f3900b1fba6
Author: Justus Winter <justus at gnupg.org>
Date: Tue May 24 17:22:08 2016 +0200
python: Make all GnuPG errors available.
* lang/python/Makefile.am (errors.i): Generate file.
* lang/python/gpgme.i: Include generated file.
* lang/python/pyme/errors.py: Pull in all errors and error sources.
Signed-off-by: Justus Winter <justus at gnupg.org>
---
lang/python/Makefile.am | 10 ++++++++--
lang/python/gpgme.i | 2 +-
lang/python/pyme/errors.py | 5 +++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 86c1965..f58f079 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -29,7 +29,12 @@ copystamp: $(srcdir)/pyme $(srcdir)/helpers.c $(srcdir)/helpers.h
if test "$(srcdir)" != "$(builddir)" ; then cp -r $^ . ; fi
touch $@
-gpgme_wrap.c pyme/pygpgme.py: gpgme.i gpgme.h copystamp
+errors.i:
+ sed -n -e \
+ '/GPG_ERR_[^ ]* =/s/ *\(.*\) = .*/%constant long \1 = \1;/p' \
+ `gpg-error-config --prefix`/include/gpg-error.h >$@
+
+gpgme_wrap.c pyme/pygpgme.py: gpgme.i errors.i gpgme.h copystamp
$(SWIG) -python -py3 $(SWIGOPT) \
-o $(builddir)/gpgme_wrap.c -outdir $(builddir)/pyme \
$<
@@ -38,7 +43,8 @@ all-local: gpgme_wrap.c pyme/pygpgme.py copystamp
$(PYTHON) $(srcdir)/setup.py build --verbose
clean-local:
- rm -rf -- build gpgme.h gpgme_wrap.c pyme/pygpgme.py copystamp
+ rm -rf -- build gpgme.h errors.i gpgme_wrap.c pyme/pygpgme.py \
+ copystamp
if test "$(srcdir)" != "$(builddir)" ; then \
rm -rf pyme helpers.c helpers.h ; \
fi
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index a82efb5..84bc6e9 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -259,7 +259,7 @@ PyObject* object_to_gpgme_t(PyObject* input, const char* objtype, int argnum) {
%}
%include "gpgme.h"
-%constant long EOF = GPG_ERR_EOF;
+%include "errors.i"
// Generating and handling pointers-to-pointers.
diff --git a/lang/python/pyme/errors.py b/lang/python/pyme/errors.py
index 5c8f922..f716421 100644
--- a/lang/python/pyme/errors.py
+++ b/lang/python/pyme/errors.py
@@ -17,6 +17,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from . import pygpgme
+from . import util
+
+util.process_constants('GPG_ERR_', globals())
class GPGMEError(Exception):
def __init__(self, error = None, message = None):
@@ -43,8 +46,6 @@ class GPGMEError(Exception):
def __str__(self):
return "%s (%d,%d)"%(self.getstring(), self.getsource(), self.getcode())
-EOF = getattr(pygpgme, "EOF")
-
def errorcheck(retval, extradata = None):
if retval:
raise GPGMEError(retval, extradata)
--
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