aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/pyme/util.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* python: Rename Python module from PyME to gpg.Daniel Kahn Gillmor2016-10-311-53/+0
| | | | | | | | This follows weeks of discussion on the gnupg-devel mailing list. Hopefully it will make it easier for people using Python to use GnuPG in the future. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python: Import from __future__ to align behavior of Python 2.7.Justus Winter2016-09-141-0/+3
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Handle slight differences between Python 2 and 3.Justus Winter2016-09-131-0/+12
| | | | | | | | | | | | | | | | | | | * lang/python/helpers.c (pyDataWriteCb): Handle Python integers being returned on Python 2. (pyDataSeekCb): Likewise. * lang/python/pyme/core.py (Data.__init__): Fix testing for string argument. (Data.new_from_filepart): Likewise. * lang/python/pyme/util.py (is_a_string): New function. * lang/python/tests/t-encrypt-large.py (read_cb): Force evaluation of generator. * lang/python/tests/t-idiomatic.py: Partly skip test on Python 2. * lang/python/tests/t-verify.py (check_result): Here, the difference between 2 and 3 really matters. We cannot change the char * conversion in Python 2 without breaking all existing applications, and using bytestrings in Python 3 would be very inconvenient. Signed-off-by: Justus Winter <[email protected]>
* python: Drop superfluous imports and trim public interface.Justus Winter2016-07-281-2/+1
| | | | | | | | | | | | | | | * lang/python/pyme/__init__.py: Avoid leaking low-level 'gpgme', make sure the main module looks nice and tidy, appease pyflakes. * lang/python/pyme/errors.py: Appease pyflakes. * lang/python/pyme/util.py: Avoid leaking low-level 'gpgme' into the module namespace. * lang/python/pyme/version.py.in: Likewise. * lang/python/tests/t-keylist.py: Drop superfluous imports. * lang/python/tests/t-sig-notation.py: Likewise. * lang/python/tests/t-sign.py: Likewise. * lang/python/tests/t-signers.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Rename compiled SWIG module.Justus Winter2016-07-281-3/+3
| | | | | | | | | | | | | | | | | Avoid the name pygpgme, as this is the name of another popular Python binding for GPGME. This commit renames the compiled Python module produced by SWIG. * lang/python/Makefile.am: Rename the compiled Python module. * lang/python/gpgme.i: Likewise. * lang/python/pyme/core.py: Likewise. * lang/python/pyme/errors.py: Likewise. * lang/python/pyme/util.py: Likewise. * lang/python/pyme/version.py.in: Likewise. * lang/python/setup.py.in: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Support the Assuan engine.Justus Winter2016-07-281-0/+6
| | | | | | | | | | | | | | * lang/python/gpgme.i: Add typemaps for the Assuan protocol callbacks. * lang/python/helpers.c (_pyme_assuan_{data,inquire,status}_cb): New functions. * lang/python/private.h (_pyme_assuan_{data,inquire,status}_cb): New prototypes. * lang/python/pyme/core.py (Context.assuan_transact): New method. * lang/python/pyme/util.py (percent_escape): New function. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/t-protocol-assuan.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Add an idiomatic interface.Justus Winter2016-07-151-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* python: Drop obsolete VCS keywords.Justus Winter2016-06-061-1/+0
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Move the base wrapper class.Justus Winter2016-05-241-78/+0
| | | | | | | * python/lang/pyme/util.py (GpgmeWrapper): Move... * python/lang/pyme/core.py: ... here. Signed-off-by: Justus Winter <[email protected]>
* python: Robust exception handling in callbacks.Justus Winter2016-05-191-3/+13
| | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* Merge branch 'justus/pyme3'Justus Winter2016-05-171-1/+0
|
* python: Share generated methods between objects.justus/pyme3Justus Winter2016-05-121-10/+16
| | | | | | | | * 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 <[email protected]>
* python: Cache generated wrapper functions.Justus Winter2016-05-121-3/+6
| | | | | | | * lang/python/util.py (GpgmeWrap.__getattr__): Cache generated wrapper functions. Signed-off-by: Justus Winter <[email protected]>
* python: Fix name of exception, make slot methods explicit.Justus Winter2016-05-121-1/+18
| | | | | | | | | * lang/python/pyme/util.py (GpgmeWrapper._getctype): Fix exception, add docstring. (GpgmeWrapper._getnameprepend): New function. (GpgmeWrapper._errorcheck): Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Delete trailing whitespace.Justus Winter2016-05-101-2/+2
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Rename bindings.Justus Winter2016-05-101-0/+72
-- Signed-off-by: Justus Winter <[email protected]>