diff options
author | Justus Winter <[email protected]> | 2016-07-28 09:16:35 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-07-28 09:16:35 +0000 |
commit | 355d7072863ac1f0f725e77141a59f3ed8a5e4af (patch) | |
tree | e307ada615dd2bb15f4c974ba888e6be53334e8e /lang/python/gpgme.i | |
parent | python: Add accessors for the protocol. (diff) | |
download | gpgme-355d7072863ac1f0f725e77141a59f3ed8a5e4af.tar.gz gpgme-355d7072863ac1f0f725e77141a59f3ed8a5e4af.zip |
python: Improve engine information handling.
* lang/python/gpgme.i (gpgme_engine_info_t): Wrap engine infos.
* lang/python/pyme/core.py (Context.engine_info): New property.
(Context.{g,s}et_engine_info): Improve docstrings.
* lang/python/pyme/results.py (EngineInfo): New class.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | lang/python/gpgme.i | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i index 2b186c4f..a372edd4 100644 --- a/lang/python/gpgme.i +++ b/lang/python/gpgme.i @@ -324,7 +324,7 @@ // Make types containing 'next' field to be lists %ignore next; -%typemap(out) gpgme_sig_notation_t, gpgme_engine_info_t, gpgme_subkey_t, +%typemap(out) gpgme_sig_notation_t, gpgme_subkey_t, gpgme_key_sig_t, gpgme_user_id_t, gpgme_invalid_key_t, gpgme_recipient_t, gpgme_new_signature_t, gpgme_signature_t, gpgme_import_status_t, gpgme_conf_arg_t, gpgme_conf_opt_t, @@ -409,6 +409,26 @@ Py_DECREF(fragile); } +%typemap(out) gpgme_engine_info_t { + int i; + int size = 0; + $1_ltype curr; + for (curr = $1; curr != NULL; curr = curr->next) { + size++; + } + $result = PyList_New(size); + for (i=0,curr=$1; i<size; i++,curr=curr->next) { + PyObject *fragile, *o; + fragile = SWIG_NewPointerObj(SWIG_as_voidptr(curr), $1_descriptor, + %newpointer_flags); + o = pygpgme_wrap_fragile_result(fragile, "EngineInfo"); + if (o == NULL) + return NULL; /* raise */ + Py_DECREF(fragile); + PyList_SetItem($result, i, o); + } +} + // Include mapper for edit callbacks |