[git] GPGME - branch, master, updated. gpgme-1.11.1-274-g864ef9b

by Ben McGinnes cvs at cvs.gnupg.org
Sat Sep 15 04:14:43 CEST 2018


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  864ef9b40f5f9d0c66a458b6033277938d7d1d50 (commit)
      from  dd7d37ca21684d4d77db4f513c6212776fc6ea82 (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 864ef9b40f5f9d0c66a458b6033277938d7d1d50
Author: Ben McGinnes <ben at adversary.org>
Date:   Sat Sep 15 12:10:05 2018 +1000

    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).

diff --git a/lang/python/examples/howto/export-secret-keys.py b/lang/python/examples/howto/export-secret-keys.py
index f0a791e..7203ded 100755
--- a/lang/python/examples/howto/export-secret-keys.py
+++ b/lang/python/examples/howto/export-secret-keys.py
@@ -84,7 +84,13 @@ else:
     if os.path.exists(os.environ["GNUPGHOME"]) is True:
         hd = os.environ["GNUPGHOME"]
     else:
-        hd = subprocess.getoutput(gpgconfcmd)
+        try:
+            hd = subprocess.getoutput(gpgconfcmd)
+        except:
+            process = subprocess.Popen(gpgconfcmd.split(),
+                                       stdout=subprocess.PIPE)
+            procom = process.communicate()
+            hd = procom[0].decode().strip()
     gpgfile = "{0}/{1}.gpg".format(hd, keyfile)
     ascfile = "{0}/{1}.asc".format(hd, keyfile)
 
diff --git a/lang/python/examples/howto/groups.py b/lang/python/examples/howto/groups.py
index b8317b6..154961b 100644
--- a/lang/python/examples/howto/groups.py
+++ b/lang/python/examples/howto/groups.py
@@ -37,7 +37,12 @@ if sys.platform == "win32":
 else:
     gpgconfcmd = "gpgconf --list-options gpg"
 
-lines = subprocess.getoutput(gpgconfcmd).splitlines()
+try:
+    lines = subprocess.getoutput(gpgconfcmd).splitlines()
+except:
+    process = subprocess.Popen(gpgconfcmd.split(), stdout=subprocess.PIPE)
+    procom = process.communicate()
+    lines = procom[0].decode().splitlines()
 
 for i in range(len(lines)):
     if lines[i].startswith("group") is True:

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

Summary of changes:
 lang/python/examples/howto/export-secret-keys.py | 8 +++++++-
 lang/python/examples/howto/groups.py             | 7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list