Commit Graph

315 Commits

Author SHA1 Message Date
Ben McGinnes
5432e5f9d1 doc: python bindings howto
* generated a new primary key for Danger Mouse in an alternative homedir.
2018-03-15 14:01:30 +11:00
Ben McGinnes
5d1dd2abe5 doc: python bindings howto
* Added sections for key generation and key editing.
2018-03-15 12:27:45 +11:00
Ben McGinnes
1d05e6aa4e doc: python bindings howto
* Added c.get_key instructions and examples.
2018-03-15 12:14:29 +11:00
Ben McGinnes
b35aaef7a3 doc: python bindings howto
* Added text for verifying signatures.
2018-03-15 11:18:02 +11:00
Ben McGinnes
6bc12a0eeb doc: python bindings howto
* Added 4 signature verification methods and partial text for them.
2018-03-15 07:20:31 +11:00
Ben McGinnes
e5c85fba25 doc: python bindings howto
* Added description for detached signatures.
2018-03-15 04:07:57 +11:00
Ben McGinnes
ada059b071 doc: python bindings howto
* Fixed multiple sample code examples of writing output to a file.
* Added the description of detached signatures.
2018-03-15 03:51:51 +11:00
Ben McGinnes
ef27f3781a doc: python bindings todo
* minor phrasing fix.
2018-03-14 20:40:50 +11:00
Ben McGinnes
423fdcd465 doc: python bindings howto
* Added recommended method of single encryption with description.
2018-03-14 20:36:30 +11:00
Ben McGinnes
a71205dc3b doc: python binding howto
* Clarified which English dialects this is written in.
* Translating to American can happen *after* it's done.
** The Yank version would probably want to change some of the examples
   anyway.
* Began the description for normal/default signing.
2018-03-14 02:40:41 +11:00
Ben McGinnes
a10dcb4f13 doc: python bindings howto
* Added a section on key selection.
* Included recommendation for using fingerprint when selecting one
  specific key.
* Also included the most ironically amusing example of multiple key
  selection in a GPG guide.  Hey, it's public data ... (heh).
2018-03-14 02:21:44 +11:00
Ben McGinnes
952b6042f7 doc: python bindings howto
* Added explanation of the ascendance of Python 3 over Python 2 in the
  guide to the intro.
* Expanded key selection description so people know what not to
  include regarding key IDs with this key selection method.
2018-03-14 01:41:21 +11:00
Ben McGinnes
c92da2c7eb doc: python bindings howto
* Added key selection for specifying signing key or keys.
2018-03-13 19:20:44 +11:00
Ben McGinnes
e489ddd08a doc: python bindings howto
* During the course of working out the updated signature methods,
  determined that key selection (including counting) will beed to be
  presented before the basic functions.
* Moved "working with keys" up.
2018-03-13 18:32:30 +11:00
Ben McGinnes
f29bda8d71 doc: python bindings howto
* Signatures have changed as a result of the recent update from Justus.
* Sample code updated.
* Text to follow later.
2018-03-13 15:03:11 +11:00
Ben McGinnes
c27a7a3f99 doc: python bindings howto
* Added text description for the decryption example.
2018-03-13 11:50:38 +11:00
Ben McGinnes
f81adeba99 doc: python bindings howto
* Added a miscellaneous work-arounds section at the end.
* Included code in said miscellaneous section for accessing the groups
  specified in a gpg.conf file.
* It's a bit ugly since it does require subprocess (but not call,
  Popen or shell access and only accesses one command).
2018-03-13 08:26:22 +11:00
Ben McGinnes
36dfbdffea doc: python bindings howto
* Fixed a spelling error in the key counting text.
2018-03-13 07:49:42 +11:00
Ben McGinnes
484e9a6229 doc: python bindings howto
* updated multi-encryption final example to be complete.
* second example shows most likely method of reading plaintext.
* updated example filenames to stick with running gag
  (i.e. secret_plans.txt).
2018-03-13 07:42:04 +11:00
Ben McGinnes
a8f48b6f57 doc: python bindings howto
* error corrections.
* multiple typesetting fixes only required due to certain archaic
  eccentricities of LaTeX.
* a couple of minor python PEP8 compliance corrections.
2018-03-13 06:09:53 +11:00
Ben McGinnes
83b1336cee doc: python bindings howto
* Fixed an error in the encryption try/except statement.
2018-03-13 05:42:50 +11:00
Ben McGinnes
0e1300ce77 doc: python bindings howto
* Added a more complicated encryption example with a few variations on
  the encryption method to account for untrusted recipient keys,
  signing or not signing, including or excluding default keys and so
  on.
2018-03-13 04:55:44 +11:00
Ben McGinnes
7ebc5a3570 doc: python bindings howto
* Switched from links to some external docs to using footnotes where
  necessary.
* Ideally the howto should be as stand alone as possible.
* Also it makes it difficult to convert to another format for
  proof-reading if there are links that the conversion can't find.
2018-03-13 00:33:11 +11:00
Ben McGinnes
172baaf4d3 doc: python bindings HOWTO
* Added instructions and code to count the number of public and secret
  keys available since it was quick and easy.
2018-03-09 20:45:14 +11:00
Ben McGinnes
f2c1e8d8d5 doc: python TODO list
* Slightly tweaked one heading to make it clear it wasn't a duplicate.
2018-03-09 20:44:02 +11:00
Ben McGinnes
0168646394 doc: python bindings howto
* Wrote the text description explaining each step in the most basic
  encryption operation.
* Will need to include additional examples for encrypting to multiple
  recipients using Context().encrypt instead of Context().op_encrypt.
2018-03-09 16:49:05 +11:00
Ben McGinnes
93252df9dc doc: python bindings TODO list
* Updated to reflect the most recent work on the HOWTO for the Python
  bindings.
2018-03-09 15:27:40 +11:00
Ben McGinnes
ab81c2d868 doc: python bindings howto
* Added example for verifying both detached and "in-line" signatures.
2018-03-09 15:22:24 +11:00
Ben McGinnes
fa4927146b docs: python bindings howto update.
* Added all four signing code examples that are most likely to be
  used: armoured, clearsigned, detached armoured and detached binary.
* May remove some examples and just discuss the differences, but it
  depends on the way the text is filled out.
2018-03-09 07:53:57 +11:00
Ben McGinnes
c767a4a359 doc: python bindings howto update
* Added example of decryption.
* included some quick notes for myself regarding aspects to explain
  when I flesh out the explanatory text.
2018-03-09 05:25:49 +11:00
Ben McGinnes
75463d5895 doc: Basic operation of the python bindings
* Added sample code for encrypting some text to a single key.
* Basically I'm just lifting existing production code and changing the
  key IDs from mine to "0x12345678DEADBEEF" for these first few
  examples.
* I'll fill in the text description after.
* Note: due to my regional location, I might split some tasks into
  more commits in order to be sure no work gets lost in case of
  emergency (or to put it another way: I know Telstra too well to
  trust them).
2018-03-09 04:42:41 +11:00
Ben McGinnes
a98f2c556f doc-howto: fundamental aspects of GPGME vs Python
* Added a section for those pythonistas who are too used to web
  programming.  Stressed that it's not simply not RESTful, it's not
  even REST-like.
* Letting me move on to drawing a very loose parallel between a
  session and a context.  The differences should become obvious in the
  subsequent sections.
2018-03-08 15:23:05 +11:00
Ben McGinnes
e8adab68f8 doc: Added multiple TODOs for inclusion in the HOWTO
* Some instructions to include are fairly obvious; as with encryption,
  decryption and signature verification.
* Some are a little less obvious.
* This includes the requests received to specifically include subkey
  management (adding and revoking subkeys on a primary key that's
  being retained.
* Added the UID equivalents to the list, as well as key selection
  matters (and may or may not include something for handling group
  lines since that involves wrapping a CLI binary).
* Key control documentation and examples requested by Mike Ingle of
  confidantmail.org.
2018-03-08 14:13:00 +11:00
Ben McGinnes
47d401d159 GPL compatible license for documentation
* Added the same, slightly modified GPL based license that is used in
  other parts of GnuPG.
2018-03-07 21:27:54 +11:00
Ben McGinnes
8a76deb11e HOWTO update
* removed one bit of whitespace.
* Marked up references to gpgme.h.
* Fixed one spelling error.
* Removed py2.6 from python search order since even if it is
  supported, it shouldn't be encouraged.
2018-03-07 20:12:26 +11:00
Ben McGinnes
5215d58ae2 GPGME Python bindings HOWTO
* Started work on the GPGME Python bindings HOWTO.
* 1,050 words to begin with at approx. 7.5KB.
* Got as far as installation.
* Includes instruction not to use PyPI for this.
2018-03-07 20:05:21 +11:00
Ben McGinnes
8f2c0f4534 TODO - HOWTO
* Added suv-entry for the new HOWTO being started and, since it has
  been started, checked it off.
2018-03-07 19:13:37 +11:00
Ben McGinnes
d4778bb23d TODO
* Slightly expanded the list.
2018-03-07 17:56:54 +11:00
Ben McGinnes
c58f61e922 WS removal
* Whitespace removal.
2018-02-26 14:09:38 +11:00
Ben McGinnes
6f2e2e0f15 LaTeX headers
* Set LaTeX headers to enable ligatures and a 12pt font by default.
* Paper size left for regional defaults.
* Using XeLaTeX for easier font control.
* Using default LaTeX font of Latin Main, but that's easy enough to change.
2018-02-26 13:51:23 +11:00
Ben McGinnes
272a8e778a Renaming ad infinitum ...
* Dropped the .txt from the end of the file ...
2018-02-20 03:13:42 +11:00
Ben McGinnes
c82b17c6ce Text conversion
* Exported from Org Mode to UTF-8 text.
* Removed my name from just under the title.
2018-02-20 03:11:50 +11:00
Ben McGinnes
ea481d4bb9 Title fix
* Fixed title.
2018-02-20 03:11:02 +11:00
Ben McGinnes
1ae3ead2cd Conflict with Phabricator files
* The developers of Phabricator, the web front-end on dev.gnupg.org
  have not implemented renderers for Markdown, Org-Mode or any other
  common markdown like language.
* They also refuse to do so.
* Instead they re-invented the wheel and implemented their own version
  of Markdown-like thing which is incompatible with everything else.
  It is called Remarkup.
* The developers of Phabricator and Remarkup have refused to provide
  conversion tools to move files to/from any format to/from Remarkup.
* They expect everyone to learn their new favourite pet project.
* Remarkup may or may not display Org Mode files, but if so then it is
  likely to only want to do so as plain text.
* There is an unaffiliated and unofficial project to convert Github
  Markdown to Remarkup via Pandoc.  This might be adapted for our use,
  but requires testing.
* Until then exporting from Org Mode to UTF-8 text is likely the least
  worst plan.
* Which means renaming this file to README.org first.
2018-02-20 02:51:02 +11:00
Ben McGinnes
fe4f3edd70 Schizophrenic file types
* Removed Markdown style heading underlining.
* Removed in-line file type declaration (which is not correctly parsed
  by the web interface on dev.gnupg.org).
2018-02-20 02:45:44 +11:00
Ben McGinnes
fb16eaa685 History path
* Fixed a typo in a filepath reference.
* Moved conjecture regarding the first version of Python used to a
  footnote.
2018-02-16 19:15:32 +11:00
Ben McGinnes
2b092bf235 Merge branch 'master' of /Users/ben/dev/hgit/mine/gnupg/gpgme/master into ben/python-docs-01 2018-02-16 02:04:57 +11:00
Ben McGinnes
6f15d82140 LaTeX margins
* Added LaTeX header for 1 inch margins in the quite likely event that
  all PDF output ultimately uses LaTeX.
2018-02-16 01:26:20 +11:00
Ben McGinnes
235d899a5f TODO Documentation
* Checked off the decision to stick with Org Mode.
2018-02-15 21:30:32 +11:00
Ben McGinnes
40da502292 TODO
* Beginning to turn the first part of this into something kind of like
  an actual TODO list as Org Mode uses it (maybe).
2018-02-15 21:28:07 +11:00
NIIBE Yutaka
b5ec21b9ba tests: Makefile portability.
* tests/gpg/Makefile.am: Don't use "export" directive.
* tests/gpgsm/Makefile.am: Ditto.
* lang/qt/tests/Makefile.am: Ditto.
* lang/python/tests/Makefile.am: Ditto.

--

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 11:14:49 +09:00
NIIBE Yutaka
c9a351f5af build: More Makefile fix.
* lang/python/tests/Makefile.am: Avoid target with '/'.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 10:27:59 +09:00
Ben McGinnes
3c3b149996 Short History
* Fixed or updated the most fundamental errors.
* Also included some details on which modules are available on PyPI,
  as well as what happened to the PyME commit log.
2018-02-15 04:19:15 +11:00
Ben McGinnes
7c662d22a8 Subsectioned history
* Split the main parts down into subsections.
* Still need to cull the incorrect stuff towards the end and add more
  recent changes.
2018-02-15 01:03:12 +11:00
Ben McGinnes
a1bc710c5f History
* Reshaping the history file to fit Org Mode's structuring for docs.
* Also said history needs to be a bit more clear (it was kind of
  unfinished).
2018-02-14 22:44:27 +11:00
Ben McGinnes
fccd2ea387 TODO
* Updated TODO.
* The entirety of the old TODO has been replaced with either more
  relevant tasks or goals for the examples and a more measured
  approach to the docs and why, in this project, Org Mode trumps reST,
  even though it's Python through and through.
2018-02-14 22:28:50 +11:00
Ben McGinnes
487ed9337e TODO
* Removed reST version of file.
2018-02-14 21:25:45 +11:00
Ben McGinnes
c4fa421619 TODO
* Converted document from reST to org-mode.
2018-02-14 21:24:54 +11:00
Ben McGinnes
1d48b04cfb Short History
* Removed reST version.
2018-02-14 21:23:04 +11:00
Ben McGinnes
d86fd7c54c Short History
* Converted document from reST to org-mode.
2018-02-14 21:21:58 +11:00
Andre Heinecke
7b5182f288
Spelling fixes for comments and doc
--
Patch provided by ka7 in dev.gnupg.org

Differential D423
2017-12-08 05:59:11 +01:00
Tobias Mueller
3cf9aedc92
python: Default whence argument for Data() to SEEK_SET.
* lang/python/gpgme.i: copied signature from gpgme.h and defaulted the
value to SEEK_SET.
* lang/python/tests/t-data.py: Added a test for no second argument
--

Having to import the os package when wanting to read a Data object is a
slight annoyance. With SWIG, we can define default parameters. This
change defaults the whence argument to SEEK_SET which is how StringIO
and BytesIO behave.

Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
2017-12-04 08:10:06 +01:00
NIIBE Yutaka
c441fb7313 tests: Make portability fix.
* lang/python/tests/Makefile.am: Distinguish target and path.
* tests/gpg/Makefile.am: Ditto.
* tests/gpgsm/Makefile.am: Ditto.

--

GNU Make is powerful enough to match path to target (and vice versa),
but BSD make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-11-21 15:35:10 +09:00
Alon Bar-Lev
57c1259308
python: Support parallel build in tests
* lang/python/tests/Makefile.am: Depend xcheck with all which was lost
due to the check hack.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-08-21 10:55:10 +02:00
Justus Winter
70c8be9efe
python: Improve keylist test.
* lang/python/tests/t-keylist.py: Check a keylist matching no keys.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-08-21 10:54:10 +02:00
Justus Winter
1e68f93dc5
python: Improve error handling.
* 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 <justus@g10code.com>
2017-07-11 12:28:39 +02:00
Justus Winter
05fa2a9c77
Add flag 'is_de_vs' to decryption results and signatures.
* NEWS: Update.
* lang/cpp/src/decryptionresult.cpp (DecryptionResult::isDeVs): New
function.
* lang/cpp/src/decryptionresult.h (DecryptionResult::isDeVs): New
prototype.
* lang/cpp/src/verificationresult.cpp (Signature::isDeVs): New
function.
* lang/cpp/src/verificationresult.h (Signature::isDeVs): New
prototype.
* lang/python/src/results.py (DecryptResult): Turn field 'is_de_vs'
into a boolean.
(Signature): Likewise.
* src/decrypt.c (_gpgme_decrypt_status_handler): Handle the new
compliance status line.
* src/verify.c (_gpgme_verify_status_handler): Likewise.
* src/gpgme.h.in (gpgme_status_code_t): Add new status codes for the
new status lines.
* src/keylist.c (parse_pub_field18): Move function to 'util.h'.
(keylist_colon_handler): Adapt callsites.
* src/status-table.c (status_table): Add new status lines.
* src/util.h (PARSE_COMPLIANCE_FLAGS): New macro.  This used to be
'parse_pub_field18', but turned into a macro to make it polymorphic.
--

When decrypting data and verifying signatures, report whether the
operations are in compliance with the criteria for data classified as
VS-NfD.  This information can the be presented to the user.

GnuPG-bug-id: 3059
Signed-off-by: Justus Winter <justus@g10code.com>
2017-06-01 14:16:11 +02:00
Justus Winter
84a203e60b
python: Fix build in certain cases.
* lang/python/setup.py.in: Prepend the Python build dir to the list of
include directories so that it takes precedence over any other include
directory.
--
Fixes the build in case an older 'gpgme.h' is installed and is picked
up by the compiler when compiling the Python module.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-18 12:22:29 +02:00
Justus Winter
6b4dd3b929
python: Fix test environment creation.
* lang/python/tests/Makefile.am (pubring-stamp): Do not depend on the
configuration files, this can trigger superfluous rebuilds.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 16:19:52 +02:00
Justus Winter
a226eca846
tests: Make sure to kill all previously running daemons.
* lang/python/tests/Makefile.am: Kill all previously running daemons
before creating the private key store.
* lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am: Likewise.
* tests/gpgsm/Makefile.am: Likewise.
--

Now that the daemons sockets are no longer created in the GNUPGHOME,
we cannot rely on cleaning the build directory to make sure they are
shut down.  Therefore, we explicitly kill any running daemons when
creating the test environment.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 15:52:12 +02:00
Justus Winter
15adff073b
tests: Harmonize test suites.
* lang/python/tests/Makefile.am: Create test environment as part of
'make all'.
* tests/gpg/Makefile.am: Make sure the private keystore is created
first.
* tests/gpgsm/Makefile.am: Create test environment as part of
'make all'.  Make sure the private keystore is created
first.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 15:49:54 +02:00
Justus Winter
979d48e823
python: Skip TOFU test if not supported by GnuPG.
* lang/python/tests/support.py (have_tofu_support): New function.
* lang/python/tests/t-quick-key-manipulation.py: Skip TOFU test if not
supported by GnuPG.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-11 12:24:41 +02:00
Alon Bar-Lev
a827382caf
python: use autoconf pre-processor when building via autoconf
* configure.ac: Add AC_PROG_CPP.
* lang/python/Makefile.am: Set CPP environment for setup.py to use.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-11 10:24:44 +02:00
Alon Bar-Lev
d785c053a9
python: fix run-tests missing python_libdir
* lang/python/tests/run-tests.py: Set python_libdir if --python-libdir
is set.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-11 10:16:47 +02:00
Justus Winter
63bec9f486
python: Prune CLEANFILES.
--
Fixes-commit: e7d9c0c3d7
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-10 15:24:03 +02:00
Justus Winter
db476e9234
python: Fix distcheck.
* lang/python/Makefile.am (uninstall-local): Explicitly request the
scheme 'posix_prefix'.  On Python2.7 the default scheme is
'posix_local', breaking distcheck.

Fixes-commit: 25e6444b3f
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-10 15:20:34 +02:00
Alon Bar-Lev
3cc90b67fa
python: Support alternatate libdir for tests
* lang/python/tests/run-tests.py: Add --python-libdir optional
parameter.

--

This will make the python tests usable for downstream that build python
module outside of autotools build system.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:48:03 +02:00
Alon Bar-Lev
7309ce6f5f
python: Read gpg-error.h using the pre-processor
* lang/python/setup.py.in: Read gpg-error.h using the pre-processor.

--

The libgpg-error may be installed in multilib configuration in which
there is a wrapper header at /usr/include that includes the actual
header at /usr/include/*. This causes invalid errors.i generation.

Let the pre-processor extract the header content instead reading it
explicitly.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:47:44 +02:00
Alon Bar-Lev
df8433bffa
python: Remove unneeded stats copy
* lang/python/setup.py.in: errors.i, gpgme.h are generated and always
newer than the original.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:44:33 +02:00
Alon Bar-Lev
25e6444b3f
python: Remove usage of PYTHON_VERSIONS
* configure.ac: Remove PYTHON_VERSIONS subst.
* lang/python/Makefile.am: Use basename of python as builddir prefix.
* lang/python/tests/run-tests.py: Likewise.

--

Two variables needs be at sync PYTHONS and PYTHON_VERSIONS, these may go
out of sync in some cases, for example in Gentoo where default python is
3.4 we get:

PYTHON='/usr/bin/python2'
PYTHONS='/usr/bin/python /usr/bin/python2'
PYTHON_VERSIONS='2.7 3.4'

We can use the basename of the python interpreter to achieve similar
effect without having to sync indexes between these two variables.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:44:16 +02:00
Alon Bar-Lev
365c649ad0
python: support .pydistutils.cfg mode
* lang/python/setup.py.in: Do not parse arguments.

--

The distutils settings can come from either command-line or
configuration file. Parsing parameters is not working in all cases.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:35:35 +02:00
Alon Bar-Lev
49195c487e
python: simplify build, some fixups
* 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 <alon.barlev@gmail.com>
2017-04-07 12:12:20 +02:00
Justus Winter
e7d9c0c3d7
python: Fix vpath builds, fix distcheck.
* lang/python/gpgme-h-clean.py: Delete file.
* lang/python/MANIFEST.in: Adapt accordingly.
* lang/python/Makefile.am (EXTRA_DIST): Likewise.
(COPY_FILES_GPG): Bring variable back.
(copystamp): Copy files.
(clean-local): Delete copied files.
(install-exec-local): Do not create and install list of installed
files.
(uninstall-local): Instead, create some explicit rules to uninstall
the extension.
* lang/python/setup.py.in: Parse arguments.  Locate files either in
the source directory, or in the build base directory.  Inline the code
from 'gpgme-h-clean.py'.  Copy 'helpers.c', add source directory as
include directory.

Fixes-commit: 801d7d8c5d
Signed-off-by: Justus Winter <justus@g10code.com>
2017-04-05 16:41:56 +02:00
Alon Bar-Lev
801d7d8c5d
python: Generate files into build directory
* lang/python/setup.py.in: Generate files within BuildExtFirstHack
adjust build flags at this point instead of global.
* lang/python/Makefile.am: Remove logic of separate source directory per
python version in favor of build directory.
* lang/python/tests/run-tests.py: Adjust build directory location.
--

Generate files into build directory, leaving the source directory clean.
Use the same source directory for multiple python version build. Result
of 'prepare' target is a standard distutil layout that can be used
easily by downstream to build all python targets in-place.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-05 14:48:47 +02:00
Andre Heinecke
f8a9ecc629
python: Don't treat skipped tests as error
* lang/python/tests/run-tests.py (failed): Don't count skipped tests
for the return code.
2017-03-30 16:22:20 +02:00
Justus Winter
159505a288
python: Fix skipping tests if running with GnuPG < 2.1.12.
* final.py: Import 'support.py' for the side-effect of checking the
GnuPG version.
* t-data.py: Likewise.
* t-protocol-assuan.py: Likewise.
* t-wrapper.py: Likewise.
* t-callbacks.py: Avoid warning about 'support' being unused.
* t-edit.py: Likewise.
* t-encrypt-sym.py: Likewise.
* t-file-name.py: Likewise.
* t-idiomatic.py: Likewise.
* t-sig-notation.py: Likewise.
* t-trustlist.py: Likewise.
* t-verify.py: Likewise.
* t-wait.py: Likewise.
* t-keylist-from-data.py: Trim unused imports.

GnuPG-bug-id: 3008
Fixes-commit: 348da58fe0
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-30 15:06:10 +02:00
Alon Bar-Lev
9786e3a96e
python,build: Reinstate prepare target.
* lang/python/Makefile.am: Fix 'prepare' target.
* lang/python/setup.py.in: Use 'abs_top_builddir' instead of guessing
the path.
--

'prepare' will prepare target at PREPAREDIR.  The automake integration
will also make use of prepare target.  Downstream distributors may
also make use of prepare target.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-03-29 11:28:18 +02:00
Justus Winter
348da58fe0
python: Skip tests if running with GnuPG < 2.1.12.
* lang/python/tests/support.py (assert_gpg_version): Fix error
message.  Skip all tests when we use GnuPG older than 2.1.12.

GnuPG-bug-id: 3008
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-27 11:11:47 +02:00
Justus Winter
f3e8d8a451
python: Wrap 'gpgme_op_keylist_from_data_start'.
* NEWS: Update.
* lang/python/gpg/core.py (Context.keylist): New keyword argument
'source'.  If given, list keys from 'source'.
* lang/python/gpgme.i: Wrap the argument to
'gpgme_op_keylist_from_data_start'.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/support.py (EphemeralContext): Do not throw an
error if no agent has been started in the context.
* lang/python/tests/t-keylist-from-data.py: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-21 12:55:33 +01:00
Justus Winter
57e64d019d
python: Fix version check.
* lang/python/tests/support.py (assert_gpg_version): Cope with
non-released versions.

Fixes-commit: e1cf8bab31
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-20 16:53:29 +01:00
Justus Winter
16b202d999
tests: Use 'gpg-agent --allow-loopback-pinentry' if applicable.
* lang/python/tests/Makefile.am (gpg-agent.conf): Do not hard-code the
option.  This breaks gpg-agent from GnuPG 2.0.
* tests/start-stop-agent: Rather, check if the option is supported and
add it to the configuration if it is.

GnuPG-bug-id: 3008
Fixes-commit: bbf19124bb
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-20 16:41:43 +01:00
Justus Winter
e1cf8bab31
python: Skip tests if GnuPG is too old.
* lang/python/tests/support.py (assert_gpg_version): New function.
* lang/python/tests/t-callbacks.py: Use the new function to skip the
test if GnuPG is too old.
* lang/python/tests/t-edit.py: Likewise.
* lang/python/tests/t-encrypt-sym.py: Likewise.
* lang/python/tests/t-quick-key-creation.py: Likewise.
* lang/python/tests/t-quick-key-manipulation.py: Likewise.
* lang/python/tests/t-quick-key-signing.py: Likewise.

GnuPG-bug-id: 3008
Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-20 16:20:02 +01:00
Justus Winter
4572e8d2ac
python: Remove superfluous initialization.
* lang/python/tests/support.py (init_gpgme): Remove.  This is an
remnant from the c tests.  Nowadays, the Python bindings initialize
GPGME automagically.
* lang/python/tests/initial.py: Remove call to 'support.init_gpgme'.
* lang/python/tests/t-callbacks.py: Likewise.
* lang/python/tests/t-decrypt-verify.py: Likewise.
* lang/python/tests/t-decrypt.py: Likewise.
* lang/python/tests/t-edit.py: Likewise.
* lang/python/tests/t-encrypt-large.py: Likewise.
* 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-export.py: Likewise.
* lang/python/tests/t-file-name.py: Likewise.
* lang/python/tests/t-idiomatic.py: Likewise.
* lang/python/tests/t-import.py: Likewise.
* lang/python/tests/t-keylist.py: Likewise.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-sign.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.
* lang/python/tests/t-trustlist.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.
* lang/python/tests/t-wait.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-20 16:07:07 +01:00
Justus Winter
9d6825be09
python: Make error message more helpful.
* lang/python/tests/run-tests.py: Make the error message shown when we
cannot locate the python module in the build tree more helpful.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-14 12:20:25 +01:00
Justus Winter
ac48499538
python: Make tests more robust.
* lang/python/tests/support.py (TemporaryDirectory): Always use our
own version even if 'tempfile.TemporaryDirectory' is provided, because
we need to use 'shutil.rmtree(..., ignore_errors=True)' to avoid it
tripping over gpg-agent deleting its own sockets.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-14 12:20:24 +01:00
Justus Winter
a4201035fd
python: Improve build system integration.
* lang/python/Makefile.am: Use 'set -e' when chaining shell commands
together in rules.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-14 12:20:21 +01:00
Justus Winter
41398779ab
python: Print path of the Python module used during tests.
* lang/python/tests/initial.py: Print path of the Python module used
during tests.  Useful to detect if by any mistake the wrong module is
picked up.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-03-02 16:06:29 +01:00
Justus Winter
a7c6353eda
python: Fix test.
* lang/python/tests/t-quick-key-manipulation.py: Modify the
configuration file in the ephemeral home directory, not the one used
by all the tests.

Fixes-commit: 15fbac9e72
Signed-off-by: Justus Winter <justus@g10code.com>
2017-02-20 10:23:41 +01:00
Justus Winter
15fbac9e72
python: Support manipulating the TOFU policy.
* NEWS: Update.
* doc/gpgme.texi: Fix typos.
* lang/python/gpg/constants/__init__.py: Import new files.
* lang/python/gpg/constants/tofu/__init__.py: New file.
* lang/python/gpg/constants/tofu/policy.py: New file.
* lang/python/gpg/core.py (Context.key_tofu_policy): New function.
* lang/python/gpgme.i: Nice reprs for gpgme_tofu_info_t.
* lang/python/setup.py.in: Install new package.
* lang/python/tests/t-quick-key-manipulation.py: Extend test.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-02-17 17:08:03 +01:00
Justus Winter
48634e651f
python: Support quick key signing.
* NEWS: Update.
* doc/gpgme.texi (gpgme_op_keysign): Fix the description of the
'expire' argument.
* lang/python/gpg/constants/__init__.py: Import new file.
* lang/python/gpg/constants/keysign.py: New file.
* lang/python/gpg/core.py (Context.key_sign): New function.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-quick-key-signing.py: New test.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-02-17 16:28:00 +01:00