[git] GPGME - branch, master, updated. gpgme-1.11.1-276-gd04fb0b

by Ben McGinnes cvs at cvs.gnupg.org
Sat Sep 15 19:38:41 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  d04fb0bf1271c91b88686c947a5b14ffc9b505ef (commit)
       via  4e8a92ed14ea3da3d92f07d5f62fd325a2adebde (commit)
      from  864ef9b40f5f9d0c66a458b6033277938d7d1d50 (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 d04fb0bf1271c91b88686c947a5b14ffc9b505ef
Author: Ben McGinnes <ben at adversary.org>
Date:   Sun Sep 16 03:36:14 2018 +1000

    Python bindings: docs
    
    * lang/python/docs/GPGMEpythonHOWTOen.org: Fixed a few errors in the
      newer sections.
    * Updated code in the examples using secret key exporting and group
      lines to reflect the Python 2.7 compatibility fixes added.

diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 38d332f..1e5db6d 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -316,12 +316,16 @@ both by and in order to create, the bindings (including both the
      :END:
 
 If specifying a selected number of languages to create bindings for,
-always leave Python last.  Currently the other languages are also
-preceding Python of either version when listed alphabetically and so
-that just happens by default currently.  If Python is set to precede
-one of the other languages then it is possible that the errors
-described here may interrupt the build process before generating
-bindings for those other languages.
+try to leave Python last.  Currently the majority of the other
+language bindings are also preceding Python of either version when
+listed alphabetically and so that just happens by default currently.
+
+If Python is set to precede one of the other languages then it is
+possible that the errors described here may interrupt the build
+process before generating bindings for those other languages.  In
+these cases it may be preferable to configure all preferred language
+bindings separately with alternative =configure= steps for GPGME using
+the =--enable-languages=$LANGUAGE= option.
 
 
 *** Multiple installations
@@ -333,7 +337,7 @@ For a veriety of reasons it may be either necessary or just preferable
 to install the bindings to alternative installed Python versions which
 meet the requirements of these bindings.
 
-On POSIX systens this will generally be most simply achieved by
+On POSIX systems this will generally be most simply achieved by
 running the manual installation commands (build, build, install) as
 described in the previous section for each Python installation the
 bindings need to be installed to.
@@ -364,7 +368,7 @@ people who installed Python using the Windows installer files from the
 The Windows versions of Python are not built using Cygwin, MinGW or
 Msys2; they're built using Microsoft Visual Studio.  Furthermore the
 version used is /considerably/ more advanced than the version which
-MinGWobtained a small number of files from many years ago in order to
+MinGW obtained a small number of files from many years ago in order to
 be able to compile anything at all.  Not only that, but there are
 changes to the version of Visual Studio between some micro releases,
 though that is is particularly the case with Python 2.7, since it has
@@ -414,10 +418,11 @@ GPGME is compiled.
 
 CFFI is currently unable to adapt to such a potentially mutable
 codebase.  If there were some means of applying SWIG's dynamic code
-generation to produce CFFI API modes of accessing the GPGME libraries
-(or the source source code directly), but such a thing does not exist
-yet either and it currently appears that work is needed in at least
-one of CFFI's dependencies before any of this can be addressed.
+generation to produce the Python/CFFI API modes of accessing the GPGME
+libraries (or the source source code directly), but such a thing does
+not exist yet either and it currently appears that work is needed in
+at least one of CFFI's dependencies before any of this can be
+addressed.
 
 So if you're a massive fan of CFFI; that's great, but if you want this
 project to switch to CFFI then rather than just insisting that it
@@ -463,8 +468,7 @@ retrain developers.
 This API does not do that.  It would not be able to do that and also
 provide access to the entire C API on which it's built.  It does,
 however, provide a very pythonic interface on top of the direct
-bindings and it's this pythonic layer with which this HOWTO deals
-with.
+bindings and it's this pythonic layer that this HOWTO deals with.
 
 
 ** Context
@@ -1062,7 +1066,16 @@ 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()
+            if sys.version_info[0] == 2:
+                hd = procom[0].strip()
+            else:
+                hd = procom[0].decode().strip()
     gpgfile = "{0}/{1}.gpg".format(hd, keyfile)
     ascfile = "{0}/{1}.asc".format(hd, keyfile)
 
@@ -1967,8 +1980,17 @@ information in Python.
 
 #+BEGIN_SRC python -i
 import subprocess
+import sys
 
-lines = subprocess.getoutput("gpgconf --list-options gpg").splitlines()
+try:
+    lines = subprocess.getoutput("gpgconf --list-options gpg").splitlines()
+except:
+    process = subprocess.Popen(gpgconfcmd.split(), stdout=subprocess.PIPE)
+    procom = process.communicate()
+    if sys.version_info[0] == 2:
+        lines = procom[0].splitlines()
+    else:
+        lines = procom[0].decode().splitlines()
 
 for i in range(len(lines)):
     if lines[i].startswith("group") is True:

commit 4e8a92ed14ea3da3d92f07d5f62fd325a2adebde
Author: Ben McGinnes <ben at adversary.org>
Date:   Sun Sep 16 03:34:36 2018 +1000

    Python bindings: examples
    
    * lang/python/examples/howto/export-secret-keys.py and groups.py:
      Updated the backwards compatibility adjustments to account for
      unicode differences between python 2 and 3.

diff --git a/lang/python/examples/howto/export-secret-keys.py b/lang/python/examples/howto/export-secret-keys.py
index 7203ded..0f4d8ee 100755
--- a/lang/python/examples/howto/export-secret-keys.py
+++ b/lang/python/examples/howto/export-secret-keys.py
@@ -90,7 +90,10 @@ else:
             process = subprocess.Popen(gpgconfcmd.split(),
                                        stdout=subprocess.PIPE)
             procom = process.communicate()
-            hd = procom[0].decode().strip()
+            if sys.version_info[0] == 2:
+                hd = procom[0].strip()
+            else:
+                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 154961b..7213538 100644
--- a/lang/python/examples/howto/groups.py
+++ b/lang/python/examples/howto/groups.py
@@ -42,7 +42,10 @@ try:
 except:
     process = subprocess.Popen(gpgconfcmd.split(), stdout=subprocess.PIPE)
     procom = process.communicate()
-    lines = procom[0].decode().splitlines()
+    if sys.version_info[0] == 2:
+        lines = procom[0].splitlines()
+    else:
+        lines = procom[0].decode().splitlines()
 
 for i in range(len(lines)):
     if lines[i].startswith("group") is True:

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

Summary of changes:
 lang/python/docs/GPGMEpythonHOWTOen.org          | 54 +++++++++++++++++-------
 lang/python/examples/howto/export-secret-keys.py |  5 ++-
 lang/python/examples/howto/groups.py             |  5 ++-
 3 files changed, 46 insertions(+), 18 deletions(-)


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




More information about the Gnupg-commits mailing list