Commit Graph

10 Commits

Author SHA1 Message Date
Justus Winter
1f318b7aaa python: Add an idiomatic interface.
* configure.ac: Bump required Python version.
* lang/python/pyme/__init__.py: Update docstring.  Import Context and
Data.
* lang/python/pyme/core.py (Context.encrypt): New function.
(Context.decrypt): Likewise.
(Context.sign): Likewise.
(Context.verify): Likewise.
* lang/python/pyme/errors.py: Add new errors.
* lang/python/pyme/util.py (process_constants): Rework and return the
inserted keys.
* lang/python/tests/Makefile.am (EXTRA_DIST): Add new keys.
* lang/python/tests/encrypt-only.asc: New file.
* lang/python/tests/sign-only.asc: Likewise.
* lang/python/tests/initial.py: Mark key 'Alpha' as trusted, import
new keys.
* lang/python/tests/support.py: Add fingerprints of known keys.
(in_srcdir): New function.
(print_data): Handle bytes too.
(mark_key_trusted): New function.
* lang/python/tests/t-decrypt-verify.py: Adjust test.  Test idiomatic
interface.
* lang/python/tests/t-decrypt.py: Test idiomatic interface.
* lang/python/tests/t-encrypt-sign.py: Likewise.
* lang/python/tests/t-encrypt-sym.py: Likewise.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-idiomatic.py: Simplify.
* lang/python/tests/t-keylist.py: Adjust to newly trusted key.
* lang/python/tests/t-sign.py: Likewise.  Test idiomatic interface.
* lang/python/tests/t-signers.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-15 18:28:09 +02:00
Justus Winter
2055a63605 python: Drop obsolete VCS keywords.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-06 14:16:01 +02:00
Justus Winter
0ebd6a1b43 python: Move the base wrapper class.
* python/lang/pyme/util.py (GpgmeWrapper): Move...
* python/lang/pyme/core.py: ... here.

Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-24 18:00:16 +02:00
Justus Winter
d90857a08c python: Robust exception handling in callbacks.
* lang/python/helpers.c (pygpgme_stash_callback_exception): New
function.
(pygpgme_raise_callback_exception): Likewise.
(pyPassphraseCb): Stash python errors.
* lang/python/helpers.h (pygpgme_raise_callback_exception): New
prototype.
* lang/python/pyme/core.py ({Context,Data}.__init__): Move common
initialization to superclass.
(Context.set_progress_cb): Hand in 'self'.
* lang/python/pyme/util.py (GpgmeWrapper.__init__): New function.
(GpgmeWrapper.__getattr__): Raise stashed exceptions.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-19 15:58:45 +02:00
Justus Winter
db34332535 Merge branch 'justus/pyme3' 2016-05-17 15:10:28 +02:00
Justus Winter
11314f0db6 python: Share generated methods between objects.
* lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch
the class.
* lang/python/tests/t-wrapper.py: Demonstrate the sharing.

Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 18:29:04 +02:00
Justus Winter
ed0ce84fbd python: Cache generated wrapper functions.
* lang/python/util.py (GpgmeWrap.__getattr__): Cache generated wrapper
functions.

Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 14:57:42 +02:00
Justus Winter
af9371eb63 python: Fix name of exception, make slot methods explicit.
* lang/python/pyme/util.py (GpgmeWrapper._getctype): Fix exception,
add docstring.
(GpgmeWrapper._getnameprepend): New function.
(GpgmeWrapper._errorcheck): Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 12:59:05 +02:00
Justus Winter
aade53a12b python: Delete trailing whitespace.
--
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-10 13:30:30 +02:00
Justus Winter
f4ba16b31e python: Rename bindings.
--
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-10 13:19:26 +02:00