[git] GPGME - branch, master, updated. gpgme-1.8.0-38-g9291eba

by Tobias Mueller cvs at cvs.gnupg.org
Wed Jan 25 18:51:49 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  9291ebaa4151a1f6c8c0601095ec45809b963383 (commit)
      from  a98951a30a6ae603ffac4ec8c5168aa6d1019933 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9291ebaa4151a1f6c8c0601095ec45809b963383
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Sat Dec 3 23:12:37 2016 +0100

    python: default op_keylist_start parameters.
    
    * lang/python/gpgme.i: Added gpgme_op_keylist_start with defaults
    * lang/python/tests/t-keylist.py: Added tests for default parameters
    --
    
    To increase the ease of use, op_keylist_start
    parameters default to sensible values.
    The empty string matches all keys.
    We assume that the user wants to retrieve public keys most of the time,
    so we default to public keys rather than secret keys.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 73533d0..c7d89db 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -541,6 +541,15 @@ wrapresult(gpgme_vfs_mount_result_t, "VFSMountResult")
     }
 }
 
+
+/* With SWIG, you can define default arguments for parameters.
+ * While it's legal in C++ it is not in C, so we cannot change the
+ * already existing gpgme.h. We need, however, to declare the function
+ * *before* SWIG loads it from gpgme.h. Hence, we define it here.     */
+gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx,
+                      const char *pattern="",
+                      int secret_only=0);
+
 /* Include the unmodified <gpgme.h> for cc, and the cleaned-up local
    version for SWIG.  We do, however, want to hide certain fields on
    some structs, which we provide prior to including the version for
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index ea2a724..5077ca6 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -219,6 +219,18 @@ result = c.op_keylist_result()
 assert not result.truncated, "Key listing unexpectedly truncated"
 
 
+# We test for a parameter-less keylist
+keyring_length = len(list(c.op_keylist_all()))
+assert keyring_length > 1,\
+                "Expected to find some keys, but got %r" % keyring_length
+
+# Then we do want to call with a pattern, only
+# i.e. without giving secret=0
+alpha_keys = list(c.op_keylist_all(b"Alpha"))
+assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len(alpha_keys)
+
+
+
 for i, key in enumerate(c.keylist()):
     try:
         if len(keys[i]) == 4:

-----------------------------------------------------------------------

Summary of changes:
 lang/python/gpgme.i            |  9 +++++++++
 lang/python/tests/t-keylist.py | 12 ++++++++++++
 2 files changed, 21 insertions(+)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list