[git] GPGME - branch, ben/docs/2018-03, updated. gpgme-1.10.0-77-gf81adeb

by Ben McGinnes cvs at cvs.gnupg.org
Mon Mar 12 22:29:58 CET 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, ben/docs/2018-03 has been updated
       via  f81adeba992a9fd3b5a199e9a2e242a0f53cf639 (commit)
      from  36dfbdffea60c529a6d1e1ff3e507be016b6a0f6 (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 f81adeba992a9fd3b5a199e9a2e242a0f53cf639
Author: Ben McGinnes <ben at adversary.org>
Date:   Tue Mar 13 08:26:22 2018 +1100

    doc: python bindings howto
    
    * Added a miscellaneous work-arounds section at the end.
    * Included code in said miscellaneous section for accessing the groups
      specified in a gpg.conf file.
    * It's a bit ugly since it does require subprocess (but not call,
      Popen or shell access and only accesses one command).

diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 979ffa0..4d02f97 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -631,6 +631,56 @@
    #+end_src
 
 
+* Miscellaneous work-arounds
+  :PROPERTIES:
+  :CUSTOM_ID: cheats-and-hacks
+  :END:
+
+** Group lines
+   :PROPERTIES:
+   :CUSTOM_ID: group-lines
+   :END:
+
+   There is not yet an easy way to access groups configured in the
+   gpg.conf file from within GPGME.  As a consequence these central
+   groupings of keys cannot be shared amongst multiple programs, such
+   as MUAs readily.
+
+   The following code, however, provides a work-around for obtaining
+   this information in Python.
+
+   #+begin_src python
+     import subprocess
+
+     lines = subprocess.getoutput("gpgconf --list-options gpg").splitlines()
+
+     for i in range(len(lines)):
+	 if lines[i].startswith("group") is True:
+	     line = lines[i]
+	 else:
+	     pass
+
+     groups = line.split(":")[-1].replace('"', '').split(',')
+
+     group_lines = groups
+     for i in range(len(group_lines)):
+	 group_lines[i] = group_lines[i].split("=")
+
+     group_lists = group_lines
+     for i in range(len(group_lists)):
+	 group_lists[i][1] = group_lists[i][1].split()
+   #+end_src
+
+   The result of that code is that =group_lines= is a list of lists
+   where =group_lines[i][0]= is the name of the group and
+   =group_lines[i][1]= is the key IDs of the group as a string.
+
+   The =group_lists= result is very similar in that it is a list of
+   lists.  The first part, =group_lists[i][0]= matches
+   =group_lines[i][0]= as the name of the group, but
+   =group_lists[i][1]= is the key IDs of the group as a string.
+
+
 * Copyright and Licensing
   :PROPERTIES:
   :CUSTOM_ID: copyright-and-license

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

Summary of changes:
 lang/python/docs/GPGMEpythonHOWTOen.org | 50 +++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)


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




More information about the Gnupg-commits mailing list