aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python (follow)
Commit message (Collapse)AuthorAgeFilesLines
* python: Fix exception leak.Justus Winter2016-06-161-0/+1
| | | | | | * lang/python/helpers.c (pygpgme_stash_callback_exception): Fix leak. Signed-off-by: Justus Winter <[email protected]>
* python: Fix license.Justus Winter2016-06-161-3/+3
| | | | | | | | Other parts of the build system are also LGPLed. * lang/python/Makefile.am: Fix license. Signed-off-by: Justus Winter <[email protected]>
* python: Improve error handling.Justus Winter2016-06-081-6/+23
| | | | | | | * lang/python/helpers.c (pyPassphraseCb): Handle write errors. (pyEditCb): Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Add function to raise exceptions from c.Justus Winter2016-06-081-0/+20
| | | | | | * lang/python/helpers.c (pygpgme_raise_exception): New function. Signed-off-by: Justus Winter <[email protected]>
* python: Fix stripping deprecated functionality.Justus Winter2016-06-082-3/+8
| | | | | | | | | * lang/python/Makefile.am (gpgme.h): Add script as input. * lang/python/gpgme-h-clean.py (deprec_func): Also match struct members. (line_break): Fix matching on struct members. Signed-off-by: Justus Winter <[email protected]>
* python: Fix type.Justus Winter2016-06-081-2/+12
| | | | | | * lang/python/gpgme.i: Use correct Python type for size. Signed-off-by: Justus Winter <[email protected]>
* python: Implement the context manager protocol.Justus Winter2016-06-082-7/+29
| | | | | | | | | | | | | * lang/python/pyme/core.py (Context.__del__): Make function idemptotent. (Context.{__enter__,__exit__}): Implement the context manager protocol. (Data.__del__): Make function idemptotent, drop debug print. (Data.{__enter__,__exit__}): Implement the context manager protocol. * lang/python/tests/t-idiomatic.py: Demonstrate this. Signed-off-by: Justus Winter <[email protected]>
* python: Fix error handling.Justus Winter2016-06-071-3/+4
| | | | | | | | * 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 <[email protected]>
* python: Wrap file-like objects on demand.Justus Winter2016-06-065-3/+127
| | | | | | | | | | | | * 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 <[email protected]>
* python: Move helper function.Justus Winter2016-06-063-31/+38
| | | | | | | | * 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 <[email protected]>
* python: Fix error handling.Justus Winter2016-06-061-8/+1
| | | | | | | * lang/python/gpgme.i (object_to_gpgme_t): Properly propagate exceptions. Signed-off-by: Justus Winter <[email protected]>
* python: Initialize GPGME for the user.Justus Winter2016-06-062-1/+6
| | | | | | | * lang/python/pyme/core.py: Call 'check_version' and explain why. * lang/python/tests/support.py (init_gpgme): Drop call here. Signed-off-by: Justus Winter <[email protected]>
* python: Drop obsolete VCS keywords.Justus Winter2016-06-0636-36/+0
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Fix test suite with GnuPG prior to 2.1.12.Justus Winter2016-06-011-1/+2
| | | | | | | * lang/python/tests/Makefile.am (gpg-agent.conf): Use 'allow-loopback-pinentry'. Signed-off-by: Justus Winter <[email protected]>
* python: Improve build system integration, fix warnings.Justus Winter2016-06-012-3/+7
| | | | | | | | * lang/python/Makefile.am: Pass CFLAGS to python build system. * lang/python/helpers.c (pyPassphraseCb): Use correct type for length. (pygpgme_data_new_from_cbs): Drop unused variable. Signed-off-by: Justus Winter <[email protected]>
* tests: Fix notation tests.Justus Winter2016-06-011-3/+2
| | | | | | | | | * lang/python/tests/t-sig-notation.py (check_result): Check critical flag. * tests/gpg/t-sig-notation.c (check_result): Likewise. Fixes-commit: 1cacd7d0 Signed-off-by: Justus Winter <[email protected]>
* python: use GPG_ERROR_CONFIG variableTobias Mueller2016-05-311-1/+1
| | | | | | | | | | | instead of calling gpg-error-config. This is useful when configuring with --with-gpgerror-prefix because then GPG_ERROR_CONFIG contains the correct /path/to/bin/gpg-error-config whereas calling gpg-error-config directly would look in the user's PATH (and not in the prefix where gpg-error-config was installed). Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-315-5/+280
| | | | | | | | | | * 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 <[email protected]>
* python: Port more tests.Justus Winter2016-05-277-7/+155
| | | | | | | | | | | | | | * lang/python/pyme/core.py (Data._error_check): Add 'gpgme_data_get_file_name' to the list of functions not returning an error code. * lang/python/tests/Makefile.am (pytests): Add new tests. * lang/python/tests/support.py (verbose): New variable. * lang/python/tests/t-data.py: Test setting and getting the filename. * lang/python/tests/t-encrypt-large.py: New file. * lang/python/tests/t-file-name.py: Likewise. * lang/python/tests/t-trustlist.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Implement data callbacks.Justus Winter2016-05-276-21/+405
| | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* python: Fix object deallocation.Justus Winter2016-05-272-14/+29
| | | | | | | | | | | | | | | | Handing a reference to the wrapper object created a non-trivial circular reference that Pythons garbage collector is unable to break. Explicitly break it by using a weak reference. * lang/python/helpers.c (pygpgme_stash_callback_exception): Retrieve object from weak reference. * lang/python/pyme/core.py (Context.__del__): Free status callback. (Context.set_passphrase_cb): Use a weak reference. (Context.set_progress_cb): Likewise. (Context.set_status_cb): Likewise. (Context.op_edit): Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Fix reading data from existing files.Justus Winter2016-05-272-16/+51
| | | | | | | | | | | | | * lang/python/pyme/core.py (Data.__init__): Add 'copy' kwargument, and pass it to functions supporting it. PEP8 fix. (Data.new_from_fd): PEP8 fix. (Data.new_from_file): Give a more helpful error message if copy is False. PEP8 fix. (Data.new_from_fd): Hand the file descriptor to 'gpgme_data_new_from_fd', not a stream. Fix docstring. * lang/python/tests/t-data.py: Add tests for this. Signed-off-by: Justus Winter <[email protected]>
* python: Improve and test Context.wait.Justus Winter2016-05-243-13/+50
| | | | | | | | | | * lang/python/pyme/core.py (Context.wait): Improve docstring. As the context passed to 'gpgme_wait' is never NULL, it is pointless to look at the returned context. Always raise exceptions. * lang/python/tests/Makefile.am (pytests): Add new test. * lang/python/tests/t-wait.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Make all GnuPG errors available.Justus Winter2016-05-243-5/+12
| | | | | | | | * 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 <[email protected]>
* python: Move the base wrapper class.Justus Winter2016-05-242-79/+77
| | | | | | | * python/lang/pyme/util.py (GpgmeWrapper): Move... * python/lang/pyme/core.py: ... here. Signed-off-by: Justus Winter <[email protected]>
* python: Support status callbacks.Justus Winter2016-05-244-0/+134
| | | | | | | | | | | | | * lang/python/helpers.c (pyStatusCb): New function. (pygpgme_set_status_cb): Likewise. * lang/python/helpers.h (pygpgme_set_status_cb): New prototype. * lang/python/pyme/core.py (Context.__init__): Initialize 'last_statuscb'. (Context._free_statuscb): New function. (Context.set_status_cb): Likewise. * lang/python/tests/t-callbacks.py: Test status callbacks. Signed-off-by: Justus Winter <[email protected]>
* python: Improve docstring.Justus Winter2016-05-241-4/+9
| | | | | | | * lang/python/pyme/core.py (Context.set_progress_cb): Improve docstring. Signed-off-by: Justus Winter <[email protected]>
* python: Improve support for edit callbacks.Justus Winter2016-05-245-7/+114
| | | | | | | | | | * 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 <[email protected]>
* python: Fix hook.Justus Winter2016-05-232-2/+3
| | | | | | | * lang/python/helpers.c (pyProgressCb): Fix getting hook data. * lang/python/tests/t-callbacks.py: Show that this works. Signed-off-by: Justus Winter <[email protected]>
* python: Move edit callback function.Justus Winter2016-05-233-45/+48
| | | | | | | | * lang/python/gpgme.i (pyEditCb): Move... * lang/python/helpers.c: ... here. * lang/python/helpers.h (pyEditCb): New prototype. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-235-2/+188
| | | | | | | | | | | | * 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 <[email protected]>
* python: Translate list of strings.Justus Winter2016-05-231-0/+34
| | | | | | * lang/python/gpgme.i: Add typemap translating list of strings. Signed-off-by: Justus Winter <[email protected]>
* python: Improve progress callbacks.Justus Winter2016-05-193-6/+54
| | | | | | | | | * 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 <[email protected]>
* python: Robust exception handling in callbacks.Justus Winter2016-05-196-13/+187
| | | | | | | | | | | | | | | | | | * 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]>
* python: Add more tests.Justus Winter2016-05-196-8/+157
| | | | | | | | | | | * 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 <[email protected]>
* python: More type conversion fixes.Justus Winter2016-05-191-2/+24
| | | | | | | | * 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 <[email protected]>
* python: Fix import.Justus Winter2016-05-191-1/+4
| | | | | | | * lang/python/helpers.c (pygpgme_exception_init): Make module import relative. Signed-off-by: Justus Winter <[email protected]>
* python: Various fixes.Justus Winter2016-05-181-1/+1
| | | | | | | * configure.ac: Fix SWIG detection, bump required Python version. * lang/python/Makefile.am: Portability fix. Signed-off-by: Justus Winter <[email protected]>
* python: Delete duplicated license texts/Werner Koch2016-05-172-848/+0
| | | | --
* Merge branch 'justus/pyme3'Justus Winter2016-05-179-12/+1
|
* python: Clean up examples.Justus Winter2016-05-1710-43/+46
| | | | | | | | | | | | | | | * 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 <[email protected]>
* python: Import GPGMEError.Justus Winter2016-05-171-1/+1
| | | | | | | | * pyme/core.py: Import GPGMEError. Fixes c5d118b2. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-174-1/+166
| | | | | | | | | * 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 <[email protected]>
* python: Share generated methods between objects.justus/pyme3Justus Winter2016-05-122-10/+18
| | | | | | | | * 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: Raise exceptions on write errors.Justus Winter2016-05-122-1/+8
| | | | | | | * lang/python/pyme/core.py (Data.write): Handle errors. * lang/python/pyme/errors.py (GPGMEError.fromSyserror): New function. Signed-off-by: Justus Winter <[email protected]>
* python: Fix writing to data buffers.Justus Winter2016-05-124-3/+71
| | | | | | | | | * 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 <[email protected]>
* python: Add a test suite.Justus Winter2016-05-123-0/+46
| | | | | | | | | * 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 <[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 function invocation.Justus Winter2016-05-121-1/+1
| | | | | | | * lang/python/pyme/core.py (Data.new_from_fd): Fix function invocation. 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]>