Home GnuPG
Diffusion GPGME 01d5c1758757

python: Extend SWIG gpgme_{sub,}key with a __repr__ method.
01d5c1758757Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

python: Extend SWIG gpgme_{sub,}key with a repr method.

* lang/python/gpgme.i: Added a genericrepr macro and use it for
gpgme_key, gpgme_subkey, and gpgme_key_sig.

To look nicer in Python's REPL.

We define a generic repr as a SWIG macro and use that to extend some
defined SWIG objects.

The alternative would have been to write a custom repr function for
each class but that would need to be changed everytime the object's
structure changes. The bindings should be easy to maintain, I guess.
This comes at the expense that the reprs are now relatively long and
contain, for example, both keyid and fingerprint.

  • Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>

Details

Provenance
4tmuelleAuthored on Dec 20 2016, 6:02 PM
justusCommitted on Feb 14 2017, 11:19 AM
Parents
rMaa49be1ab80c: python: Remove the -builtin flag for SWIG.
Branches
Unknown
Tags
Unknown

Event Timeline

Justus Winter <justus@g10code.com> committed rM01d5c1758757: python: Extend SWIG gpgme_{sub,}key with a __repr__ method. (authored by Tobias Mueller <muelli@cryptobitch.de>).Feb 14 2017, 11:19 AM