Commit Graph

71 Commits

Author SHA1 Message Date
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