Justus Winter
72afb68f8c
python: Improve docstring.
...
* lang/python/pyme/core.py (Context.set_progress_cb): Improve
docstring.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-24 18:00:16 +02:00
Justus Winter
09803c4a81
python: Improve support for edit callbacks.
...
* lang/python/helpers.c (pyEditCb): Stash exceptions.
* lang/python/pyme/core.py (Context.op_edit): Hand in 'self'.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: Test edit callbacks.
* lang/python/tests/t-edit.py: New file.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-24 13:13:35 +02:00
Justus Winter
283f0bdc3d
python: Fix hook.
...
* lang/python/helpers.c (pyProgressCb): Fix getting hook data.
* lang/python/tests/t-callbacks.py: Show that this works.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-23 18:23:34 +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
a42d814a65
python: Port more tests.
...
* lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Set
LD_LIBRARY_PATH.
(pytests): Add new tests.
* lang/python/tests/t-callbacks.py: Trim imports.
* lang/python/tests/t-encrypt-sign.py: New file.
* lang/python/tests/t-export.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-23 15:43:55 +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
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
464d404c88
python: Add more tests.
...
* lang/python/tests/Makefile.am (py_tests): Add new tests.
* lang/python/tests/support.py (print_data): New function.
* lang/python/tests/t-decrypt.py: Use new function.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-sign.py: New file.
* lang/python/tests/t-encrypt-sym.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-19 11:09:45 +02:00
Justus Winter
c1c893e338
python: More type conversion fixes.
...
* lang/python/helpers.c (pyPassphraseCb): Cope with 'uid_hint' being
NULL, convert it to an Unicode object, and cope with the callback
returning both Unicode and bytes objects.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-19 11:09:45 +02:00
Justus Winter
07f71cd177
python: Fix import.
...
* lang/python/helpers.c (pygpgme_exception_init): Make module import
relative.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-19 11:09:45 +02:00
Justus Winter
2c3a5d93e7
python: Various fixes.
...
* configure.ac: Fix SWIG detection, bump required Python version.
* lang/python/Makefile.am: Portability fix.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-18 15:37:38 +02:00
Werner Koch
9f14a24076
python: Delete duplicated license texts/
...
--
2016-05-17 16:57:11 +02:00
Justus Winter
db34332535
Merge branch 'justus/pyme3'
2016-05-17 15:10:28 +02:00
Justus Winter
10328324c8
python: Clean up examples.
...
* lang/python/examples/delkey.py: Clean up example.
* lang/python/examples/encrypt-to-all.py: Likewise.
* lang/python/examples/genkey.py: Likewise.
* lang/python/examples/inter-edit.py: Likewise.
* lang/python/examples/sign.py: Likewise.
* lang/python/examples/signverify.py: Likewise.
* lang/python/examples/simple.py: Likewise.
* lang/python/examples/t-edit.py: Likewise.
* lang/python/examples/verifydetails.py: Likewise.
* lang/python/pyme/__init__.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-17 14:22:22 +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
9ceaec2591
python: Port more tests.
...
* lang/python/Makefile.am: Add bits from the c test suite.
* lang/python/support.py: New file.
* lang/python/t-decrypt.py: Likewise.
* lang/python/t-encrypt.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-17 14:18:21 +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
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
e64bffe030
python: Add a test suite.
...
* configure.ac: Add new Makefile.
* lang/python/Makefile.am: Add subdirectory.
* lang/python/tests/Makefile.am: New file.
* lang/python/tests/t-wrapper.py: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 15:37:00 +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
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
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
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
c89d3a71ad
python: Make test case more robust.
...
* lang/python/examples/t-edit.py: Check if key is found.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-12 11:51: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
bbeee5e1a0
python: Fix simple example.
...
* lang/python/examples/simple.py: Flush stdout, encode name as
UTF-8 before passing it to GPGME.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-11 13:51:40 +02:00
Justus Winter
a29babd07c
python: Integrate into the build system.
...
* configure.ac: Make Python bindings configurable, add new Makefile.
* lang/python/Makefile.am: New file.
* lang/python/setup.py: Integrate into the build system.
* m4/ax_pkg_swig.m4: New file from the autoconf archive.
* m4/m4_ax_swig_python.m4: Likewise.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-11 13:33:05 +02:00
Justus Winter
11392a80d9
python: PEP8 fixes.
...
Cherry picked from 0267c151
.
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-10 14:45:44 +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
000dbb5b9a
python: Drop Debian packaging.
...
--
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-10 13:21:34 +02:00
Justus Winter
f4ba16b31e
python: Rename bindings.
...
--
Signed-off-by: Justus Winter <justus@gnupg.org>
2016-05-10 13:19:26 +02:00