Commit Graph

492 Commits

Author SHA1 Message Date
Ben McGinnes
1b9d30db08 python examples: protonmail hkp scripts
* fixed a bug in the import try statement for both versions.
2018-11-06 14:11:01 +11:00
Ben McGinnes
13e09bd21a docs: typo
* lang/python/doc/src/gpgme-python-howto: s/Revokinging/Revoking/g
2018-11-03 18:12:25 +11:00
Ben McGinnes
78be1e2f54 docs: python docs restructure
* Moved the what's new section out of the HOWTO (mostly), in
  anticipation of expanding the docs to be more than merely a HOWTO.
2018-10-31 03:41:47 +11:00
Ben McGinnes
d5c22966d5 docs: python
* dropped the ".org" extension and added a mode line for each file as
  this will make scripting format conversions a lot easier.
2018-10-31 03:06:24 +11:00
Ben McGinnes
04791c8967 docs: python howto
* Fixed a few spelling and grammatical errors.
2018-10-23 23:38:56 +11:00
Ben McGinnes
59e38e3d2c Python: docs tweaks
* Fixed a minor error in how the reST version of the HOWTO is
  generated.
* Updated the help() in __init__.py with a little more detail as to
  why not to use the lower level functions.
2018-10-22 05:43:36 +11:00
Ben McGinnes
651a1afe80 python bindings: callback test
* lang/python/tests/t-callbacks.py: Updated test logic to try
  generating a key which expires in 2099 and if that fails then
  fallback to an expiration in 2037 in an attempt to catch the 32-bit
  systems.
2018-10-20 11:07:55 +11:00
Daniel Kahn Gillmor
9de1c96ac3 python: do not export HAVE_CXX11 definition
* lang/python/gpgme.i: ignore HAVE_CXX11 in SWIG interface

--

If there are two distinct builds (a) and (b) of gpgme which both build
python bindings, and build (a) also happens to build the C++ bindings,
then the generated gpg/gpgme.py file from build (a) will not be usable
with the .so generated in build (b), despite them being exactly the
same, and having nothing to do with C++.

In particular, it will fail with:

-----------
  File "…/gpg/__init__.py", line 99, in <module>
    from . import core
  File "…/gpg/core.py", line 10, in <module>
    from . import gpgme
  File "…/gpg/gpgme.py", line 152, in <module>
    HAVE_CXX11 = _gpgme.HAVE_CXX11
AttributeError: module 'gpg._gpgme' has no attribute 'HAVE_CXX11'
-----------

By asking SWIG to ignore this definition, we stabilize the generated
.py and the .so, ensuring that they are more cleanly interoperable.
2018-10-18 00:30:32 -04:00
Daniel Kahn Gillmor
a81534fed8 doc: convert more http:// links to https://
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Daniel Kahn Gillmor
2f12427e41 doc: use https:// for www.gnu.org
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Werner Koch
ecfa48fffa
build: Move config.h to conf/config.h
* conf/: New dir.
* configure.ac (AC_CONFIG_HEADER): Move header to conf dir.
* doc/Makefile.am (mkdefsinc): Adjust rule.
* lang/python/Makefile.am (copystamp): Ditto.
--

C++ uses those stupid files without a suffix and thus the new standard
header <version> as included by newer other libc++ versions may
conflict with the VERSION file in out top directory.   This change
should solve the problem.

GnuPG-bug-id: 4168
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-10-05 15:14:58 +02:00
Ben McGinnes
033da18b88 docs: whitespace bug
* Same as before, but exported.
2018-10-05 02:41:45 +10:00
Ben McGinnes
a8d4aa6f76 docs: org to texinfo whitspace bug
* replaced "." in headings with "·" to prevent whitspace being
  appended by texinfo and breaking git.
2018-10-05 02:38:14 +10:00
Ben McGinnes
0b5930b276 docs: python
* Fixed an error in the new index page and then exported to the other
  two "source" formats.
2018-10-05 02:30:20 +10:00
Ben McGinnes
4825887972 docs: python
* lang/python/doc/meta/TODO.org: Added the two major documentation
  build system tasks to the TODO list.
* Added an index page in preparation for sorting out the second of
  those TODO lists (Docutils is a lot easier to handle than Texinfo).
* Meanwhile, have confirmed that it all builds just fine under
  GNU/Linux, OS X and FreeBSD while retaining the documentation, so
  that's a nice improvement from 1.11.1.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-05 01:47:56 +10:00
Ben McGinnes
f3fc737382 python: makefiles
* doc/Makefile.am: Removed a bit I forgot about.
* Renamed lang/python/docs to lang/python/doc bvecause apparently
  automake cares about that too.
* Decided to be extra explicit in the manifest because if I don't then
  all sorts of things get deleted ... like lang/python
* Tested on an external linux system just in case my osx workstation
  introduces too much weirdness.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 21:10:46 +10:00
Ben McGinnes
2cca422ca4 python: make file
* lang/python/Makefile.am: Attempting to remove the docs/meta
  directory did a lot worse than I thought it was doing, so better to
  just be sure the documentation is available than destroy the entire
  bindings directory.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 18:28:47 +10:00
Ben McGinnes
582f14d97a python: make file
* lang/python/Makefile.am: Now that gpg2 has been renamed back to gpg
  and gpg1 is semi-deprecated, we should check what the actual gpg
  binary is with gpgconf and use that rather than make assumptions per
  system.
* Also, it means less worry if gpg3 is ever a thing.  (Trust me, I
  remember the Python 1 to 2 transition as well as the current 2 to 3
  transition).  ;)

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 18:11:01 +10:00
Ben McGinnes
a174b26943 docs: more whitespace checks
* lang/python/docs/texinfo/short-history.texi:
2018-10-04 07:20:32 +10:00
Ben McGinnes
962dfca9b8 dpcs: python howto
* More updates to the docs themselves and the versions to be available
  with the next release.
* .texi and .rst copies of the HOWTO and the short history of (this
  part) of the project.
2018-10-04 07:09:40 +10:00
Ben McGinnes
2151b9828a docs: python
* More restructuring.  Also the painstaking task of deciphering some
  of the more eclectic aspects of Texinfo and make.
2018-10-04 07:06:57 +10:00
Ben McGinnes
a982f91315 docs: python bindings
* Restructured the docs directory to account for the GNU preferred
  source doc format (.texi) and the Python preferred source doc
  format (.rst) and the real source doc format (.org).
* Both the perceived source formats will need to be generated from the
  .org files and included at this stage.  Unfortunately there is not
  yet a native org-to-rst transformation method in the org-mode
  software in Emacs nor is there a a direct means of going from reST
  to Org-mode from Docutils.  There's only third party packages like
  Pandoc and, while very good, there is no guarantee of consistency;
  so we can't entirely automate this bit (yet).
2018-10-04 06:57:51 +10:00
Ben McGinnes
b280205319 docs: pre-python preparation
* doc/Makefile.am: removed the python howto from this file, restoring
  it to just the main project and the newer .js files.
* deleted: doc/gpgme-python-howto.texi
* renamed the Short_History.org file to short-history.org to keep the
  naming conventions similar.
* All the Python files can (and should) live together.
2018-10-04 01:42:12 +10:00
Ben McGinnes
23894ac9a9 python bindings: CPython order
* Changed the order of python versions the configure/make process
  checks for, placing Python 3.7 ahead of 3.6.
* Updated the HOWTO documentation to reflect this change.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-03 06:58:51 +10:00
Ben McGinnes
76bdfabb05 docs: python bindings
* Tightened up the docs a little bit, updated the "what's new"
  section, dropped the "-draft" version in preparation for GPGME
  1.12.0's release.
* Exported another .texi version (and updated the draft copies to this
  commit (which ought to be 1.11.1-beta313).

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-01 02:10:03 +10:00
Ben McGinnes
837a476053 python bindings: fixing decrypt-verify
* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 19:32:45 +10:00
Ben McGinnes
11403a4635 python bindings: ctx.decrypt
* lang/python/src/core.py: Fixed methods of detecting whether verify
  is a boolean variable or a list.
* Added methods of catching the missing keys exceptions.
* Still retained PEP8 compliance (which might have been where one or
  two problems crept in).
* Though this is essentially the correct behaviour, it still does not
  quite fit the otiginal test; so that will also require some adjustment.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 16:28:54 +10:00
Ben McGinnes
ce045a1ef9 example: local signatures
* lang/python/examples/howto/local-sign-group.py: added the bit where
  specifying the signing key is actually used for signing rather than
  just pruning the list of keys to certify.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 23:23:37 +10:00
Ben McGinnes
a047e0f68e example: python bindings
* lang/python/examples/howto/local-sign-group.py: locally sign every
  key in a group line except one's own keys.  Intended to address the
  sort of thing one might see on lists like PGPNET or other closed
  groups amongst activists, journalists, etc. where everyone encrypts
  to all recipients, but may not sign everyone's keys publicly..

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 22:45:37 +10:00
Ben McGinnes
1d40d360bc docs: python bindings installation
* lang/python/docs/gpgme-python-howto.org: added a section on
  installing the bindings to a python virtualenv.
2018-09-27 14:06:48 +10:00
Ben McGinnes
b9aea3b9c2 tests: python bindings
* Fixed the final assertion to look for what will actually be reported
  in that case instead of something else (i.e. it looks for an
  IMPORT_ERROR status code).
2018-09-27 10:07:08 +10:00
Ben McGinnes
7c9f49a499 examples: python bindings
* Fixed homedir specifying logic in several cases.
2018-09-27 09:57:50 +10:00
Ben McGinnes
b625258d54 docs: a typographical two-step
* Sometimes you really do need or want punctuation in a heading, but
  ideally without something else generating whitespace and other
  annoyances to go with it.
* Trying a real decimal point instead.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 10:17:39 +10:00
Ben McGinnes
62e4e2cb5e docs and examples: python bindings
* Woumd up the "what's new" section.
* Added an example for sending a key to the keyservers via hkp4py.
* Updated the export key code to use a more complete check for the
  $GNUPGHOME location.
* Expanded on the installation and reinstallation troubleshooting
  section.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 09:59:31 +10:00
Ben McGinnes
e9da4d9710 docs: python bindings howto
* Added a What's New section to summarise changes since the last
  release.  There have been quite a few and some attention does need
  to be drawn to some of them.
* Confirming certain issues with some platform builds, especially
  BSD/OSX vs. Linux issues which will need to update the installation
  troubleshooting guides.
2018-09-25 04:32:13 +10:00
Ben McGinnes
b12b2cc996 docs and examples: python bindings howto
* Added more comprehensive examples using hkp4py and added a couple
  more example scripts for protonmail.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 19:36:54 +10:00
Ben McGinnes
ced4bdbbb2 examples: python bindings and hkp4py updates
* Mostly tightening up the details on the hkp4py example script.
* Also fixed a typo in the LGPL boiler plate text included in all the
  other example scripts for the HOWTO.
2018-09-23 11:43:34 +10:00
Ben McGinnes
6ed9a77c92 python bindings: importing from keyservers with hkp4py
* added a new example script to search the keyservers and import the
  results, this time using Marcel Fest's hkp4py module.
* Updated the key importing section to match this addition.
* Tested with the current version of hkp4py from github.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 08:18:44 +10:00
Ben McGinnes
3622576105 docs: python bindings howto
* Confirmed that updates to the tests have significant'y improved that
  output.
* Updated some of the additional notes for the section on hkp4py.
** This is in anticipation adding at least import examples using that
   module as well.  It may also include adding examples of exporting a
   key and uploading it to the keyservers.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 05:37:40 +10:00
Werner Koch
6878126b6f
python: Fix a couple of syntax errors.
* lang/python/tests/t-keylist-from-data.py: Add missing line
continuation.
* lang/python/tests/t-keylist.py: Ditto.
* lang/python/tests/t-quick-key-creation.py: Ditto.
* lang/python/tests/t-quick-subkey-creation.py: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Werner Koch
dcdabf5f2e
python: Silence a few warnings.
* src/gpgme.h.in: Obsolete "class" also for Python.
* lang/python/gpgme.i: Silenece a swig warning.  Silence a gcc
warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Werner Koch
9f19b3aaec
python: Fix regression in the test suite.
* lang/python/tests/Makefile.am (GNUPGHOME): Remove stray backslash.
--

Fixes-commit: d09d19fa9f
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Werner Koch
a824f4498e
tests: Don't try using keys from a scmartcard.
* tests/gpg/Makefile.am: Disable scdaemon
* lang/python/tests/Makefile.am: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Ben McGinnes
5cb67257f2 docs: python bindings and its special request
* Added some material on using the new-ish hkp4py module with GPGME.
* Example code will be added later once a couple of little issues are
  addressed.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-20 11:38:20 +10:00
Ben McGinnes
362caaf02f docs: python bindings
* Updated the Cython example code slightly, along with the
  corresponding explanation.
2018-09-18 08:32:30 +10:00
Ben McGinnes
f4d83800d8 docs: python bindings howto
* Tightened up the Cython demonstration.
2018-09-17 14:33:02 +10:00
Ben McGinnes
44c846345e docs: cython sanitized
* Sanitized the shell command examples of extraneous whitespace.
* Removed keycount.c as sanitising it is pointless and it will be
  generated by Cython when the example is followed.
* Regenerated the .texi version.
2018-09-16 13:58:34 +10:00
Ben McGinnes
61c08f7435 docs: python bindings howto
* Added new advanced section with an example of using the Python
  bindings with CPython code compiled back to C code using Cython.
* Though it may seem a bit counter-intuitive to use the bindings just
  to go back to C via a different route, this is not actually stupid.
* Added examples/howto/advanced/cython/ directory.
* Added keycount.pyx, setup.py and the keycount.c file which the first
  two generated with Cython.  Not including the .so and .o files from
  the build.
* Exported the .texi version of the howto for the main docs.
2018-09-16 13:48:12 +10:00
Ben McGinnes
fbec29fdac docs: even more edits
* doc/gpgme-python-howto.texi: hunting down and killing commas,
  Oxford or not it can't stay in a heading.
2018-09-16 11:06:32 +10:00
Ben McGinnes
2a1b0b88d9 docs: more edits
* lang/python/docs/gpgme-python-howto.org: more tweaks and edits,
  along with another build of output formats.
* doc/gpgme-python-howto.texi: updated texinfo version for parent docs.
2018-09-16 10:52:30 +10:00
Ben McGinnes
91b26b0638 docs: whitespace culled
* lang/python/docs/gpgme-python-howto.org: Identified and fixed the
  headings which kept generating lines with trailing whitespace when
  exporting to Texinfo format and adjusted them to prevent that.
2018-09-16 09:47:05 +10:00
Ben McGinnes
766ec0e4a3 docs: renaming and drafts
* lang/python/docs/gpgme-python-howto.org: Renamed file to better fit
  the rest of the project's docs.
* Added a section on the very unofficial drafts I periodically post
  links to since they're often the easiest way to get a web version in
  front of someone in a hurry.
2018-09-16 08:36:10 +10:00
Ben McGinnes
7e9df9b9e3 docs: Python howto update
* lang/python/docs/GPGMEpythonHOWTOen.org: Added corresponding GPGME
  version number to table at the start and cut the shortcut from the
  groups.py example.
* doc/gpgme-python-howto.texi: New export of Texinfo file for docs
  build.
2018-09-16 06:35:02 +10:00
Ben McGinnes
d04fb0bf12 Python bindings: docs
* lang/python/docs/GPGMEpythonHOWTOen.org: Fixed a few errors in the
  newer sections.
* Updated code in the examples using secret key exporting and group
  lines to reflect the Python 2.7 compatibility fixes added.
2018-09-16 03:36:14 +10:00
Ben McGinnes
4e8a92ed14 Python bindings: examples
* lang/python/examples/howto/export-secret-keys.py and groups.py:
  Updated the backwards compatibility adjustments to account for
  unicode differences between python 2 and 3.
2018-09-16 03:34:36 +10:00
Ben McGinnes
864ef9b40f Python examples: backwards compatibility
* lang/python/examples/howto/groups.py: subprocess update
* lang/python/examples/howto/export-secret-keys.py: subprocess update

  Both of these try the nice and easy method of getting the subprocess
  output available in Python 3, but will fall back to the older Popen
  method if it doesn't work.  Essentially this is to be a little nicer
  to Python 2.7.15 (even though the examples are filled with warnings
  that py2 support is not guaranteed with the examples).
2018-09-15 12:10:05 +10:00
Ben McGinnes
55991aa916 docs: python bindings
* minor typographic update.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-31 17:36:45 +10:00
Ben McGinnes
1d00fb987b python bindings: estreams fix
* lang/python/src/core.py: Adjusted new_from_estream function to alias
  new_from_stream instead of fd.
* fixed the _gpgme import errors introduced in commit
  08cd34afb7 by changing the exported
  functions/types to match the inner module where all the work is
  done, rather than the outer one(s).

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-30 15:41:31 +10:00
Ben McGinnes
18ea838671 python bindings: core
* lang/python/src/core.py: expanded gpgme_error check lists.
2018-08-30 01:01:23 +10:00
Ben McGinnes
dcedddecb6 python bindings: core
* lang/python/src/core.py: added gpgme_data_set_flag to the errorcheck
  funtion.
2018-08-30 01:01:23 +10:00
Ben McGinnes
6078b53033 python bindings: core
* lang/python/src/core.py: added new function new_from_estream to wrap
  new_from_fd just like new_from_stream does and for the same reason.
2018-08-30 01:01:23 +10:00
Ben McGinnes
f7e5ae7f16 docs: python bindings - protonmail examples
* lang/python/docs/GPGMEpythonHOWTOen.org: Updated links to the
  ProtonMail keyserver import scripts and added a warning regarding
  being unable to update third party keys.
* lang/python/examples/howto/pmkey-import-alt.py: added usage.
* lang/python/examples/howto/pmkey-import.py: added usage.
2018-08-29 20:30:57 +10:00
Ben McGinnes
02d0b97bfe docs: python bindings HOWTO
* Finished CFFI vs SWIG bit in known issues.
* tidied up some of the structure.
* Fixed some minor errors and links.
2018-08-29 04:14:24 +10:00
Ben McGinnes
a8a983c5bc docs: python bindings
* Added section on why no CFFI.
2018-08-29 03:42:46 +10:00
Ben McGinnes
c2831e2377 docs: python howto
* Added another key import example using ProtonMail's new keyserver.
2018-08-28 18:45:37 +10:00
Ben McGinnes
1c261b9fa3 docs: python bindings
* Added details on installation troubleshooting.
2018-08-28 06:42:27 +10:00
Ben McGinnes
75bc5e6356 Python bindings examples
* import-key.py: fixed a minor typo.
* pmkey-import.py: locates and imports keys from the ProtonMail keyserver.
* pmkey-import-alt.py: the same as the previous except with setting an
  alternative $GNUPGHOME directory.
2018-08-19 14:32:30 +10:00
Ben McGinnes
03b899dbe1 Python bindings setup file
* Moved the build import back up where it belongs.
* Included comments indicating how to build and install for multiple
  Python versions beyond the first 2 on the same system.
2018-08-19 00:21:47 +10:00
Ben McGinnes
5facba45c8 Python bindings tests: Near PEP8 compliance
* PEP8 compliance for the vast majoeity of the tests.
2018-08-18 20:29:14 +10:00
Ben McGinnes
b5fbe90676 Python bindings examples: PEP8 conpliance
* Appears to be complete compliance.
2018-08-18 18:46:47 +10:00
Ben McGinnes
fc55caccfc Python bindings setup: Near PEP8 compliance
* lang/python/version.py.in: Fixed most things, but there's still an
  issue near the build portion with the existing Python bugs referenced.
* lang/python/setup.py.in: Now PEP8 compliant.
2018-08-18 18:19:16 +10:00
Ben McGinnes
8a6a73b9c4 Python bindings constants: PEP8 compliance (almost)
* PEP8 compliance for all constants except the globals in
  src/constants/__init__.py depending on whether the import sequence
  affects the globals themselves.
2018-08-18 15:36:23 +10:00
Ben McGinnes
7962cde13c Python bindings src: PEP8 compliance
* import namespace clearance for src/*.py.
* Fixed a handful of is/is not None checks as well.
2018-08-18 15:05:34 +10:00
Ben McGinnes
279cac0ffb Symmetric example
* lang/python/examples/howto/symcrypt-file.py: *sigh*; passphrase was
  right the first time, just the error check that wasn't.
* I really should stop second guessing myself one of these days ...

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-14 02:55:56 +10:00
Ben McGinnes
a256d84882 Symmetric encryption example
* lang/python/examples/howto/symcrypt-file.py: Fixed the error code
  and the passphrase key word arg.
2018-08-14 02:48:38 +10:00
Ben McGinnes
ed5ef8293c Symmetric encryption example.
* lang/python/examples/howto/symcrypt-file.py: A variation on standard
  key based encryption.
2018-08-14 02:22:36 +10:00
Ben McGinnes
94bf13e78e PEP8 compliance and other code fixes
* 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 <ben@adversary.org>
2018-08-10 11:25:01 +10:00
Ben McGinnes
b6d2a66b41 Link fixes
* lang/python/README: Fixed links in both versions of the README.
2018-08-10 03:42:15 +10:00
Andre Heinecke
d09d19fa9f
Make GNUPGHOME for tests overridable
* lang/python/tests/Makefile.am,
lang/qt/tests/Makefile.am,
tests/Makefile.am,
tests/gpg/Makefile.am,
tests/gpgsm/Makefile.am,
tests/opassuan/Makefile.am (GNUPGHOME): Make variable explict.

--
If the build directory has too long path, gpgme could fail.
This is similar to

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206

In order to fix that, this patch extracts the GNUPGHOME variable
to be presented directly in the Makefile and thus overridable by
command line option.

A build system can then create a symlink to the GNUPGHOME directory
in /tmp and use that symlink as the GNUPGHOME directory
thus making the path very short.

GnuPG-Bug-Id: T4091

Patch provided by vlmarek
2018-08-06 09:30:47 +02:00
Ben McGinnes
4d1642b11e docs: python bindings howto
* Fixed and tested the changes necessary for org-mode to correctly
  parse pythonic (Python 3) indentation.
* Updated the source blocks to recommended upper case for BEGIN_SRC
  and END_SRC.
* Tested and confirmed XHTML output matches correct examples.
* Tested against pseudo-control output via exporting from org-mode to
  org-mode and then exporting that to XHTML.  Remaining differences
  appear to be discarding the custom tags used to provide X[HT]ML id
  elements to each section which does not appear to offer any benefit.
* Exporting directly to XHTML or other HTML output should no longer
  cause problems, but if there are any then the first step should be
  exporting from org-to-org and then exporting that to XHTML.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-07-23 01:35:12 +10:00
Ben McGinnes
d7c5366d58 doc: python bindings howto
* Another retrofitting of the HOWTO Python example code, this time
  following adjustments to python-mode configuration and having
  trawled through the org-mode mailing lists for clues.
2018-07-23 01:35:12 +10:00
Ben McGinnes
b47e1bb98a doc: python bindings howto
* Added org-mode byline.
2018-07-23 01:35:12 +10:00
Ben McGinnes
1bb3f8409d python bindings: example scripts
* Fixed incorrect mention of output prompt referencing secret keys
  when the scripts are only for exporting public keys in whole or
  minimised forms.
2018-07-13 20:36:27 +10:00
Ben McGinnes
0e760e396f example scripts: python work-arounds
* fixed three typos which were guaranteed to break said script.
2018-07-10 13:40:18 +10:00
Ben McGinnes
1eceacaff4 docs: python bindings howto
* Complete typographic overhaul.
* Removed all section level indentation since it does not affect
  output formatting, but might affect source code examples.
* In text-mode stripped out all tabs which had crept in and replaced
  them with four spaces.
* Updated all code examples (again) to conform with Python-mode.
* Bumped version number in preparation for next release of GPG 2.2.9
  and corresponding GPGME release.
2018-07-09 21:30:20 +10:00
Ben McGinnes
cacca62d06 python bindings: howto examples
* Made sure all example scripts meet PEP8 compliance.
* Required fixing approx. a dozen of them in minor ways.
2018-07-08 03:40:35 +10:00
Ben McGinnes
5bca499750 python bindings: scheming serpents
* Apparently I am wrong and Scheme is the new Python after all.
* Non-import related PEP8 compliance must wait for another day, though
  the other PEP8 fixes remain.
2018-07-02 05:05:09 +10:00
Ben McGinnes
789ea1b019 python bindings: gpg.core
* Changed id/else statements to a more pythonic form from scheme
  masquerading as python - sorry Justus, it had to go ;).
* With the added bonus of enabling PEP8 compliance in those sections.
* Fixed remaining PEP8 compliance issues with the exception of the
  imports at the beginning of the file (changing those will break the
  entire module, so we'll cope with it as it is).
2018-07-02 03:55:19 +10:00
Ben McGinnes
43a2b57545 python bindings: python 3.7
* Bindings confirmed to work with the newly released 3.7.0.
* Updated M4 file to reflect this change and correct the Python binary
  search order (3.7 is not yet given priority, but will still be found
  first via the more generic python3 executable).
* Updated setup.py.in, bindings documentation and README to reflect this.
2018-06-29 14:26:30 +10:00
Ben McGinnes
48174b2bcc whitespace police:
* There's always one or, in this case, two.
2018-06-28 18:51:47 +10:00
Ben McGinnes
6aec7d6e4a docs: python bindings howto
* Updated official doc (the org-mode file) with the instructions on
  importing and exporting both public and secret keys.
2018-06-28 18:51:47 +10:00
Ben McGinnes
a7ccdc51ef python bindings examples
* Added a secret key export variant which saves output as both GPG
  binary and ASCII armoured, plus saves in $GNUPGHOME and uses
  multiple methods of determining what that location is.
2018-06-28 18:51:47 +10:00
Ben McGinnes
7fc7e80e54 python bindings examples
* Added a key import variant which accesses the SKS keyservers in a
  RESTful fashion and then imports or attempts to import the response.
2018-06-28 18:51:47 +10:00
Ben McGinnes
0d163a7d12 python bindings examples: three export scripts
* Example of default exporting keys.
* Example of exporting minimised keys.
* Example of exporting secret keys to a file with correct permissions.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-06-28 18:51:47 +10:00
Ben McGinnes
4251cae34d python bindings: import example
* Added an example script for importing a key from a file (either
  ASCII armoured or not).
2018-06-28 18:51:47 +10:00
Ben McGinnes
a5b91b21f5 python bindings: export secret keys
* The holy grail: a function to export secret keys.
* GPGME will still invoke pinentry and gpg-agent as usual to authorise
  the export.
* Mostly similar to the two previous export functions for public keys
  except that it will return None if the result had a length of zero
  bytes.  Meaning that the difference between the specified pattern
  (if any) not matching available keys and an incorrect passphrase is
  not able to be determined from this function (or the underlying one
  for that matter).

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-06-28 18:51:47 +10:00
Ben McGinnes
7faef33d13 python bindings: export public keys
* Updated key_export and key_export_minimal to return None where a
  pattern matched no keys in a manner simnilar to the possible result
  of key_export_secret.
2018-06-28 18:51:47 +10:00
Ben McGinnes
89c548efdf python bindings: export public keys
* Added functions for exporting public keys to gpg.core in both
  complete form and in minimised form.
* Rather than letting people need to worry about the export modes we
  are simply separating the functions as people would be more familiar
  with from the command line usage anyway.
* Functions added for Context are: ctx.key_export_minimal and
  ctx.key_export as the default or full export.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-06-28 18:48:05 +10:00
Ben McGinnes
19c5267f86 python bindings: core import statements
* Fixed the bit I broke while fixing the PEP8 compliance issues.
2018-06-17 22:42:43 +10:00
Ben McGinnes
a5b24ae46c python bindings: core — PEP8 compliance
* Fixed most of the PEP8 errors in core.py
* Those remaining may need more than little edits and are a bit
  strange (too clearly the result of a programmer who has spent far
  too much time dealing with Lisp so that for Python it looks
  ... strange).
2018-06-17 15:58:44 +10:00