aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/src/errors.py (unfollow)
Commit message (Collapse)AuthorFilesLines
2025-02-03python: Remove Python bindingsIngo Klöcker1-212/+0
* README: Update. * configure.ac: Remove checks, variables and file generations related to the Python bindings. Remove python from available_languages and default_languages. * lang/Makefile.am (DIST_SUBDIRS): Remove python. * lang/python: Remove. * m4/ax_pkg_swig.m4, m4/ax_python_devel.m4, m4/python.m4: Remove. -- The Python bindings have been moved to a separate Git repository: gpgmepy. GnuPG-bug-id: 7262
2019-06-04python: Fix typo in DecryptionError exception.NIIBE Yutaka1-3/+3
* lang/python/src/errors.py (DecryptionError): Rename from DeryptionError. (UnsupportedAlgorithm): Use DecryptionError. -- GnuPG-bug-id: 4478 Reported-by: Jan Girlich Signed-off-by: NIIBE Yutaka <[email protected]>
2018-08-18Python bindings src: PEP8 complianceBen McGinnes1-7/+8
* import namespace clearance for src/*.py. * Fixed a handful of is/is not None checks as well.
2018-08-10PEP8 compliance and other code fixesBen McGinnes1-7/+29
* Ran all the .py files in src/ and below through Yapf. * Included some manual edits of core.py, this time successfully making two notorious sections a bit more pythonic than scheming. * Left the module imports as is. * This will be committed if it passes the most essential test: compiling, installing and running it. Signed-off-by: Ben McGinnes <[email protected]>
2017-07-11python: Improve error handling.Justus Winter1-24/+85
* NEWS: Update. * lang/python/src/core.py (Context.__read__): New helper function. (Context.encrypt): Attach partial results to exceptions. (Context.decrypt): Likewise. (Context.sign): Likewise. (Context.verify): Likewise. * lang/python/src/errors.py (GpgError): Move the core of GPGMEError to this class, add a nicer interface for it. This makes the errors thrown by this library more uniform, and allows us to track the underlying error in synthesized high-level errors. (GPGMEError): Simplify. (...): Make sure to call the parent classes' constructor in all other classes. -- Attach partial results to errors. Some operations return results even though they signal an error. Of course this information must be taken with a grain of salt. But often, this information is useful for diagnostic uses or to give the user feedback. Since the normal control flow is disrupted by the exception, the callee can no longer return results, hence we attach them to the exception objects. GnuPG-bug-id: 3271 Signed-off-by: Justus Winter <[email protected]>
2017-04-07python: simplify build, some fixupsAlon Bar-Lev1-0/+0
* lang/python/gpg/version.py.in: Rename to lang/python/version.py.in. configure.ac: Generate version.py.in in lang/python. * lang/python/MANIFEST.in: Include version.py explicitly. * lang/python/gpg: Rename to 'src'. * lang/python/Makefile.am: Do not copy source files, do not use absolute directories, support lib64 in uninstall, clean also dist directory, use symlink for gpg src. * lang/python/setup.py.in: Use builddir, copy sources into builddir, copy version.py into module. -- Simplify build to symlink the gpg sources into builddir instead of copying. This requires handling of version.py as generated file. In addition apply some cleanups: Drop the absolution pathes, clean the dist directory as well, support lib64 for sitelib at uninstall. Signed-off-by: Alon Bar-Lev <[email protected]>
2016-10-31python: Improve constants module.Justus Winter1-0/+1
* lang/python/gpg/constants/__init__.py: Import all modules below 'constants/'. Interface hygiene: delete 'util'. * lang/python/gpg/constants/data/encoding.py: Delete 'util'. * lang/python/gpg/constants/event.py: Likewise. * lang/python/gpg/constants/import.py: Likewise. * lang/python/gpg/constants/keylist/mode.py: Likewise. * lang/python/gpg/constants/md.py: Likewise. * lang/python/gpg/constants/pk.py: Likewise. * lang/python/gpg/constants/protocol.py: Likewise. * lang/python/gpg/constants/sig/mode.py: Likewise. * lang/python/gpg/constants/sigsum.py: Likewise. * lang/python/gpg/constants/validity.py: Likewise. * lang/python/gpg/errors.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
2016-10-31python: Rename Python module from PyME to gpg.Daniel Kahn Gillmor1-6/+6
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]>
2016-10-13python: Make 'get_key' more idiomatic.Justus Winter1-3/+19
* lang/python/pyme/core.py (Context.get_key): Raise errors.KeyNotFound if the key is not found. This error is both a KeyError for idiomatic error handling as well as a GPGMEError so we don't break existing code. * lang/python/pyme/errors.py (KeyNotFound): New class. * lang/python/tests/support.py (no_such_key): New variable. * lang/python/tests/t-keylist.py: Test the new behavior. Signed-off-by: Justus Winter <[email protected]>
2016-09-14python: Import from __future__ to align behavior of Python 2.7.Justus Winter1-0/+3
-- Signed-off-by: Justus Winter <[email protected]>
2016-07-28python: Drop superfluous imports and trim public interface.Justus Winter1-0/+3
* 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]>
2016-07-28python: Rename compiled SWIG module.Justus Winter1-9/+9
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]>
2016-07-15python: Add an idiomatic interface.Justus Winter1-2/+57
* 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]>
2016-06-06python: Drop obsolete VCS keywords.Justus Winter1-1/+0
-- Signed-off-by: Justus Winter <[email protected]>
2016-05-24python: Make all GnuPG errors available.Justus Winter1-2/+3
* 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]>
2016-05-12python: Raise exceptions on write errors.Justus Winter1-0/+4
* 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]>
2016-05-10python: Delete trailing whitespace.Justus Winter1-2/+2
-- Signed-off-by: Justus Winter <[email protected]>
2016-05-10python: Rename bindings.Justus Winter1-0/+0
-- Signed-off-by: Justus Winter <[email protected]>
2015-05-05Python 3 port of PyMEBen McGinnes1-0/+46
* The entirety of the Python 3 port of PyME up to commit 2145348ec54c6027f2ea20f695de0277e2871405 * The old commit log has been saved as lang/py3-pyme/docs/old-commits.log * Can be viewed as a normal (separate) git repository at https://github.com/adversary-org/pyme3 * Utilising the submodule feature of git was deliberately skipped on humanitarian grounds (in order to prevent pain and suffering on the part of anyone having to manage this repository).