Justus Winter
0d4e95621e
python: Improve progress callbacks.
...
* lang/python/helpers.c (pyProgressCb): Stash python errors, convert
'what' to Unicode object.
* lang/python/pyme/core.py (Context.set_progress_cb): Hand in 'self'.
* lang/python/tests/t-callbacks.py: Test progress callbacks.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-19 16:08:33 +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
64e5fe767f
python: Import GPGMEError.
...
* pyme/core.py: Import GPGMEError.
Fixes c5d118b2
.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-17 14:18:21 +02:00
Justus Winter
c5d118b2a7
python: Raise exceptions on write errors.
...
* lang/python/pyme/core.py (Data.write): Handle errors.
* lang/python/pyme/errors.py (GPGMEError.fromSyserror): New function.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 18:01:24 +02:00
Justus Winter
f7094d8358
python: Fix writing to data buffers.
...
* lang/python/gpgme.i: Add typemap for buffers.
* lang/python/pyme/core.py (Data.write): Fix function.
* lang/python/tests/Makefile.am: Add new test.
* lang/python/tests/t-data.py: New file.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 17:59:21 +02:00
Justus Winter
e3d3d366bd
python: Fix function invocation.
...
* lang/python/pyme/core.py (Data.new_from_fd): Fix function
invocation.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 12:59:05 +02:00
Justus Winter
ce5121ad53
python: Handle interpreter shutdown.
...
* lang/python/pyme/core.py: Avoid races at interpreter shutdown. This
silences the most annoying occurrences, however this problem also
affects the SWIG generated code, which might indicate that the real
problem is somewhere else. If so, this change can be easily reverted.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 11:53:43 +02:00
Justus Winter
d60deb8a12
python: Fix type translation.
...
* lang/python/gpgme.i: Adjust to Python3's string type being
'Unicode', not 'bytes'. Fix type checking.
* lang/python/core.py (Data.write): Add docstring mentioning the
expected type of parameter 'buffer'.
(Data.read): Adjust read loop. Also, use a saner chunk size, and join
all chunks at the end instead of adding them.
* lang/python/examples/simple.py: Adjust example.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 11:49:17 +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