[git] GPGME - branch, master, updated. gpgme-1.8.0-7-gae21d27

by Tobias Mueller cvs at cvs.gnupg.org
Thu Dec 1 17:45:08 CET 2016


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  ae21d2705fc46725e1f9af1651b68d16155d1501 (commit)
       via  154389f2a5e4c13081cf0624222aad29ee480b56 (commit)
       via  db2f6c1ca3d2ef228f4ca6653d594537622c8588 (commit)
      from  fd4d476214ae06e33f4a6dac534d3deca5cc6cd3 (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 ae21d2705fc46725e1f9af1651b68d16155d1501
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Wed Nov 30 23:08:47 2016 +0100

    python: Check "buffer" when writing to sys.stdout for python2 compat.
    
    * lang/python/tests/support.py (print_data): Add check for buffer.
    --
    
    When running with something like make -C lang/python check verbose=2 the
    test would fail under python2, because the file objects do not have a
    buffer property.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index f991c6d..0b04bb6 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -48,7 +48,11 @@ def print_data(data):
         except:
             # Hope for the best.
             pass
-        sys.stdout.buffer.write(data)
+
+        if hasattr(sys.stdout, "buffer"):
+            sys.stdout.buffer.write(data)
+        else:
+            sys.stdout.write(data)
 
 def mark_key_trusted(ctx, key):
     class Editor(object):

commit 154389f2a5e4c13081cf0624222aad29ee480b56
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Nov 29 23:26:20 2016 +0100

    python: Make Context have a repr method.
    
    * lang/python/gpg/core.py (Context.__repr__): New function.
    --
    
    This makes Context objects look nicer in a REPL.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index 748bcbb..43856ab 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -204,6 +204,14 @@ class Context(GpgmeWrapper):
         self.pinentry_mode = pinentry_mode
         self.protocol = protocol
 
+    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}"
+            ")").format(self)
+
     def encrypt(self, plaintext, recipients=[], sign=True, sink=None,
                 passphrase=None, always_trust=False, add_encrypt_to=False,
                 prepare=False, expect_sign=False, compress=True):

commit db2f6c1ca3d2ef228f4ca6653d594537622c8588
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Wed Nov 30 08:47:29 2016 +0100

    python: Make Results have a nicer __repr__.
    
    * lang/python/gpg/results.py (Result.__str__): Renamed to '__repr__'
    ...
    * lang/python/gpg/results.py (Result.__repr__): ... and added fields.
    --
    
    So that it looks a bit nicer in the Python REPL.
    
    It looked like this before:
    
    In [2]: gpg.core.get_engine_info()[0]
    Out[2]:
    <gpg.results.EngineInfo at 0x7fb23509a240>
    
    Now the output is
    
    In [2]: gpg.core.get_engine_info()[0]
    Out[2]:
    EngineInfo(file_name='/usr/bin/gpg2', home_dir=None,
    protocol=0, req_version='1.4.0', version='2.1.11')
    
    This also applies to other results, e.g. the ImportResult.
    
    Note that the format now changed from "<Class >" to "Class()". The
    Python documentation on repr states: "For many object types, including
    most builtins, eval(repr(obj)) == obj."
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/gpg/results.py b/lang/python/gpg/results.py
index 3383896..46ebeec 100644
--- a/lang/python/gpg/results.py
+++ b/lang/python/gpg/results.py
@@ -64,10 +64,10 @@ class Result(object):
 
             setattr(self, key, getattr(fragile, key))
 
-    def __str__(self):
-        return '<{} {}>'.format(
+    def __repr__(self):
+        return '{}({})'.format(
             self.__class__.__name__,
-            ', '.join('{}: {}'.format(k, getattr(self, k))
+            ', '.join('{}={!r}'.format(k, getattr(self, k))
                       for k in dir(self) if not k.startswith('_')))
 
 class InvalidKey(Result):

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

Summary of changes:
 lang/python/gpg/core.py      | 8 ++++++++
 lang/python/gpg/results.py   | 6 +++---
 lang/python/tests/support.py | 6 +++++-
 3 files changed, 16 insertions(+), 4 deletions(-)


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




More information about the Gnupg-commits mailing list