[git] GPGME - branch, master, updated. gpgme-1.8.0-71-g92adc9b

by Justus Winter cvs at cvs.gnupg.org
Tue Feb 14 16:36:19 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  92adc9bbf640eb5d9177d3ba0189e0f6cee4e995 (commit)
       via  9fc9533c2835ec53c4fd4f822b09e9fec14626d0 (commit)
       via  fdc4e33dc3f6c84fe9d7bf9795c603ae3cf5f28d (commit)
       via  e17ab84129045512cf60c221ee43aa877507662f (commit)
       via  99b7f4f34dd595579181a696ae976a678fe00d49 (commit)
      from  30a603580e0f196c721fa4bd44d24077d9bc06c3 (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 92adc9bbf640eb5d9177d3ba0189e0f6cee4e995
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 16:30:30 2017 +0100

    python: Wrap utility functions.
    
    * NEWS: Update.
    * lang/python/gpg/core.py (pubkey_algo_string): New function.
    (pubkey_algo_name): Add docstring.
    (hash_algo_name): Likewise.
    (get_protocol_name): Likewise.
    (addrspec_from_uid): New function.
    * lang/python/gpgme.i (gpgme_pubkey_algo_string): Result must be
    freed.
    (gpgme_addrspec_from_uid): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index 125d54e..a974ec7 100644
--- a/NEWS
+++ b/NEWS
@@ -13,9 +13,11 @@ Noteworthy changes in version 1.8.1 (unreleased)
  cpp: Key::addUid()                                 NEW.
  qt: CryptoConfig::stringValueList()                NEW.
  gpgme_data_rewind                                  UN-DEPRECATE.
- py: Context.__init__  EXTENDED: New keyword argument home_dir.
- py: Context.home_dir  NEW.
- py: Context.keylist   EXTENDED: New keyword argument mode.
+ py: Context.__init__        EXTENDED: New keyword arg home_dir.
+ py: Context.home_dir        NEW.
+ py: Context.keylist         EXTENDED: New keyword arg mode.
+ py: core.pubkey_algo_string NEW.
+ py: core.addrspec_from_uid  NEW.
 
 
 Noteworthy changes in version 1.8.0 (2016-11-16)
diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index e07ec33..18a7e3a 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -1118,15 +1118,64 @@ class Data(GpgmeWrapper):
                 chunks.append(result)
             return b''.join(chunks)
 
+def pubkey_algo_string(subkey):
+    """Return short algorithm string
+
+    Return a public key algorithm string (e.g. "rsa2048") for a given
+    SUBKEY.
+
+    Returns:
+    algo      - a string
+
+    """
+    return gpgme.gpgme_pubkey_algo_string(subkey)
+
 def pubkey_algo_name(algo):
+    """Return name of public key algorithm
+
+    Return the name of the public key algorithm for a given numeric
+    algorithm id ALGO (cf. RFC4880).
+
+    Returns:
+    algo      - a string
+
+    """
     return gpgme.gpgme_pubkey_algo_name(algo)
 
 def hash_algo_name(algo):
+    """Return name of hash algorithm
+
+    Return the name of the hash algorithm for a given numeric
+    algorithm id ALGO (cf. RFC4880).
+
+    Returns:
+    algo      - a string
+
+    """
     return gpgme.gpgme_hash_algo_name(algo)
 
 def get_protocol_name(proto):
+    """Get protocol description
+
+    Get the string describing protocol PROTO.
+
+    Returns:
+    proto     - a string
+
+    """
     return gpgme.gpgme_get_protocol_name(proto)
 
+def addrspec_from_uid(uid):
+    """Return the address spec
+
+    Return the addr-spec (cf. RFC2822 section 4.3) from a user id UID.
+
+    Returns:
+    addr_spec - a string
+
+    """
+    return gpgme.gpgme_addrspec_from_uid(uid)
+
 def check_version(version=None):
     return gpgme.gpgme_check_version(version)
 
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index dc691dd..c7fc14e 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -113,6 +113,8 @@
 /* Release returned buffers as necessary.  */
 %typemap(newfree) char * "gpgme_free($1);";
 %newobject gpgme_data_release_and_get_mem;
+%newobject gpgme_pubkey_algo_string;
+%newobject gpgme_addrspec_from_uid;
 
 %typemap(arginit) gpgme_key_t [] {
   $1 = NULL;

commit 9fc9533c2835ec53c4fd4f822b09e9fec14626d0
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 16:16:05 2017 +0100

    python: Use the correct function to free buffers.
    
    * lang/python/gpgme.i (char *): Free using 'gpgme_free'.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 792567f..dc691dd 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -111,7 +111,7 @@
 }
 
 /* Release returned buffers as necessary.  */
-%typemap(newfree) char * "free($1);";
+%typemap(newfree) char * "gpgme_free($1);";
 %newobject gpgme_data_release_and_get_mem;
 
 %typemap(arginit) gpgme_key_t [] {

commit fdc4e33dc3f6c84fe9d7bf9795c603ae3cf5f28d
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 15:56:41 2017 +0100

    python: Add keylist mode parameter.
    
    * NEWS: Update.
    * lang/python/gpg/core.py (Context.keylist): Add 'mode' parameter.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index 7ec3dfb..125d54e 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Noteworthy changes in version 1.8.1 (unreleased)
  gpgme_data_rewind                                  UN-DEPRECATE.
  py: Context.__init__  EXTENDED: New keyword argument home_dir.
  py: Context.home_dir  NEW.
+ py: Context.keylist   EXTENDED: New keyword argument mode.
 
 
 Noteworthy changes in version 1.8.0 (2016-11-16)
diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index 79d1f53..e07ec33 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -483,12 +483,14 @@ class Context(GpgmeWrapper):
             plainbytes = data.read()
         return plainbytes, result
 
-    def keylist(self, pattern=None, secret=False):
+    def keylist(self, pattern=None, secret=False,
+                mode=constants.keylist.mode.LOCAL):
         """List keys
 
         Keyword arguments:
         pattern	-- return keys matching pattern (default: all keys)
-        secret	-- return only secret keys
+        secret	-- return only secret keys (default: False)
+        mode    -- keylist mode (default: list local keys)
 
         Returns:
                 -- an iterator returning key objects
@@ -496,6 +498,7 @@ class Context(GpgmeWrapper):
         Raises:
         GPGMEError	-- as signaled by the underlying library
         """
+        self.set_keylist_mode(mode)
         return self.op_keylist_all(pattern, secret)
 
     def assuan_transact(self, command,

commit e17ab84129045512cf60c221ee43aa877507662f
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 15:55:20 2017 +0100

    python: Nicer repr for user ids.
    
    * lang/python/gpgme.i (_gpgme_user_id): Provide a nicer repr() for
    user ids.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index c0993ee..792567f 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -676,3 +676,7 @@ _gpg_unwrap_gpgme_ctx_t(PyObject *wrapped)
 %extend _gpgme_key_sig {
   genericrepr(KeySig)
 };
+
+%extend _gpgme_user_id {
+  genericrepr(UID)
+};

commit 99b7f4f34dd595579181a696ae976a678fe00d49
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 13:43:01 2017 +0100

    python: Add convenience functions for the home directory.
    
    * NEWS: Update.
    * lang/python/gpg/core.py (Context.__init__): Add 'home_dir' argument.
    (__repr__): Include 'home_dir'.
    (Context.home_dir): New property.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index 4405f6c..7ec3dfb 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Noteworthy changes in version 1.8.1 (unreleased)
  cpp: Key::addUid()                                 NEW.
  qt: CryptoConfig::stringValueList()                NEW.
  gpgme_data_rewind                                  UN-DEPRECATE.
+ py: Context.__init__  EXTENDED: New keyword argument home_dir.
+ py: Context.home_dir  NEW.
 
 
 Noteworthy changes in version 1.8.0 (2016-11-16)
diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index 43856ab..79d1f53 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -176,7 +176,7 @@ class Context(GpgmeWrapper):
     def __init__(self, armor=False, textmode=False, offline=False,
                  signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT,
                  protocol=constants.PROTOCOL_OpenPGP,
-                 wrapped=None):
+                 wrapped=None, home_dir=None):
         """Construct a context object
 
         Keyword arguments:
@@ -186,6 +186,7 @@ class Context(GpgmeWrapper):
         signers		-- list of keys used for signing (default [])
         pinentry_mode	-- pinentry mode (default PINENTRY_MODE_DEFAULT)
         protocol	-- protocol to use (default PROTOCOL_OpenPGP)
+        home_dir        -- state directory (default is the engine default)
 
         """
         if wrapped:
@@ -203,13 +204,14 @@ class Context(GpgmeWrapper):
         self.signers = signers
         self.pinentry_mode = pinentry_mode
         self.protocol = protocol
+        self.home_dir = home_dir
 
     def __repr__(self):
         return (
             "Context(armor={0.armor}, "
             "textmode={0.textmode}, offline={0.offline}, "
             "signers={0.signers}, pinentry_mode={0.pinentry_mode}, "
-            "protocol={0.protocol}"
+            "protocol={0.protocol}, home_dir={0.home_dir}"
             ")").format(self)
 
     def encrypt(self, plaintext, recipients=[], sign=True, sink=None,
@@ -610,6 +612,14 @@ class Context(GpgmeWrapper):
         errorcheck(gpgme.gpgme_engine_check_version(value))
         self.set_protocol(value)
 
+    @property
+    def home_dir(self):
+        """Engine's home directory"""
+        return self.engine_info.home_dir
+    @home_dir.setter
+    def home_dir(self, value):
+        self.set_engine_info(self.protocol, home_dir=value)
+
     _ctype = 'gpgme_ctx_t'
     _cprefix = 'gpgme_'
 

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

Summary of changes:
 NEWS                    |  5 ++++
 lang/python/gpg/core.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++---
 lang/python/gpgme.i     |  8 +++++-
 3 files changed, 78 insertions(+), 5 deletions(-)


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




More information about the Gnupg-commits mailing list