Justus Winter
990492ea4f
python: Fix type.
...
* lang/python/gpgme.i: Use correct Python type for size.
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-08 17:12:00 +02:00
Justus Winter
f8f9bf06bc
python: Fix error handling.
...
* lang/python/gpgme.i: Fix freeing an uninitialized pointer in the
error handling of generated wrapper functions by explicitly storing
the pointer in a local variable which can be initialized.
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-07 19:34:51 +02:00
Justus Winter
8196edf9ca
python: Wrap file-like objects on demand.
...
* lang/python/gpgme.i (gpgme_data_t): Use new function to create
wrapper objects if necessary, and deallocate them after the function
call.
* lang/python/helpers.c (object_to_gpgme_data_t): New function.
* lang/python/helpers.h (object_to_gpgme_data_t): New prototype.
* lang/python/tests/Makefile.am (pytests): Add new test.
* lang/python/tests/t-idiomatic.py: New file.
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-06 14:16:04 +02:00
Justus Winter
26c3accc95
python: Move helper function.
...
* lang/python/gpgme.i (object_to_gpgme_t): Move...
* lang/python/helpers.c: ... here.
* lang/python/helpers.h (object_to_gpgme_t): New prototype.
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-06 14:16:04 +02:00
Justus Winter
89eb0cd4d6
python: Fix error handling.
...
* lang/python/gpgme.i (object_to_gpgme_t): Properly propagate
exceptions.
Signed-off-by: Justus Winter <justus@g10code.com>
2016-06-06 14:16:04 +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
afa0dd56e1
python: Port more tests.
...
* lang/python/gpgme.i: Hide length fields of notations.
* lang/python/tests/Makefile.am (pytests): Add new tests.
* lang/python/tests/t-decrypt-verify.py: New file.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-31 16:22:31 +02:00
Justus Winter
2ae847c027
python: Implement data callbacks.
...
* lang/python/gpgme.i (object_to_gpgme_t): Set exception on error.
* lang/python/helpers.c (pyDataReadCb): New function.
(pyDataWriteCb): Likewise.
(pyDataSeekCb): Likewise.
(pyDataReleaseCb): Likewise.
(pygpgme_data_new_from_cbs): Likewise.
* lang/python/helpers.h (pygpgme_data_new_from_cbs): New prototype.
* lang/python/pyme/core.py (Data.__init__): Fix docstring, fix read
callbacks.
(Data.__del__): Fix read callbacks.
(Data._free_readcb): Drop function.
(Data._free_datacbs): New function.
(Data.new_from_cbs): Fix setting the callbacks.
(Data.write): Raise stashed exceptions.
(Data.read): Likewise.
* lang/python/tests/t-callbacks.py: Test new functionality.
* lang/python/tests/t-data.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-27 14:04:28 +02:00
Justus Winter
7bc9cc717e
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@gnupg.org>
2016-05-24 18:00:16 +02:00
Justus Winter
5476ca6813
python: Move edit callback function.
...
* lang/python/gpgme.i (pyEditCb): Move...
* lang/python/helpers.c: ... here.
* lang/python/helpers.h (pyEditCb): New prototype.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-23 18:09:22 +02:00
Justus Winter
c9cc0412e9
python: Translate list of strings.
...
* lang/python/gpgme.i: Add typemap translating list of strings.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-23 15:41:06 +02:00
Justus Winter
db34332535
Merge branch 'justus/pyme3'
2016-05-17 15:10:28 +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
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