[git] GPGME - branch, master, updated. gpgme-1.12.0-120-ga0dbdfe

by Ben McGinnes cvs at cvs.gnupg.org
Wed Jan 2 01:22:10 CET 2019


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  a0dbdfebbb60f0d34dd16894803e95221d8be668 (commit)
       via  a2e7c863c821ca035f1e3f8077bdae3b0f81f5eb (commit)
       via  207d4289d84971d11ec1824fbe7d4a2be63b56e4 (commit)
       via  ef9355c2fe8f81ccd73e0ed45ce33e925928f8e1 (commit)
      from  d406471d4bf9c79140e4bc91de7d316ec7465892 (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 a0dbdfebbb60f0d34dd16894803e95221d8be668
Merge: a2e7c86 d406471
Author: Ben McGinnes <ben at adversary.org>
Date:   Wed Jan 2 11:19:36 2019 +1100

    python docs: post installer
    
    * Merging post installer script.
    * Included ammended Sphinx config file to try to reduce the
      auto-generated EPUB validation failures it produces.
    
    Signed-off-by: Ben McGinnes <ben at adversary.org>


commit a2e7c863c821ca035f1e3f8077bdae3b0f81f5eb
Author: Ben McGinnes <ben at adversary.org>
Date:   Wed Jan 2 11:06:14 2019 +1100

    python: post installer doc fix script
    
    * Got rid of the bash bit in the comments.
    * Made the final printed instructions far more obvious.
    
    Signed-off-by: Ben McGinnes <ben at adversary.org>

diff --git a/lang/python/post_installer.py b/lang/python/post_installer.py
index f711589..b9fd36f 100755
--- a/lang/python/post_installer.py
+++ b/lang/python/post_installer.py
@@ -122,11 +122,6 @@ help:
         @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 """)
 
-print("""
-You may now generate your preferred documentation format with either Sphinx 
-or Texinfo.
-""")
-
 info_path = os.path.realpath(sysconfig._PREFIX + "/share/info")
 info_paths = os.environ["INFOPATH"].split(":")
 
@@ -141,18 +136,12 @@ for ipath in info_paths:
     else:
         pass
 
-# This will very likely require root or sudo access, so running this script
-# with the same access as used to install the bindings in the first place is
-# highly recommended.
-#
-# bash variant (run in lang/python/doc/texinfo/):
-#
-# for x in *.texi:
-#     makeinfo -v --no-split $x
-# done ;
-#
-# Or to generate HTML:
-#
-# for x in *.texi:
-#     makeinfo -v --no-split --html $x
-# done ;
+print("""
+You may now build your preferred documentation format using either:
+
+ 1. Sphinx in the doc/rst/ directory; and/or
+ 2. Texinfo or Makeinfo in the doc/texinfo/ directory.
+
+Alternatively the original Org mode source files can be found in the doc/src/
+directory.
+""")

commit 207d4289d84971d11ec1824fbe7d4a2be63b56e4
Author: Ben McGinnes <ben at adversary.org>
Date:   Wed Dec 26 11:01:33 2018 +1100

    python: examples
    
    * Fixed inter-edit.py so it will actually work now.
    * made 3 others executable.
    * Fixed the semantics of assuan.py's instructions.
    
    Tested-by: Ben McGinnes <ben at adversary.org>
    Signed-off-by: Ben McGinnes <ben at adversary.org>

diff --git a/lang/python/examples/assuan.py b/lang/python/examples/assuan.py
old mode 100644
new mode 100755
diff --git a/lang/python/examples/decryption-filter.py b/lang/python/examples/decryption-filter.py
old mode 100644
new mode 100755
index 1b04184..d0fc3a4
--- a/lang/python/examples/decryption-filter.py
+++ b/lang/python/examples/decryption-filter.py
@@ -16,10 +16,10 @@
 # along with this program; if not, see <https://www.gnu.org/licenses/>.
 """A decryption filter
 
-This demonstrates decryption using gpg3 in three lines of code.  To
+This demonstrates decryption using gpg in three lines of code.  To
 be used like this:
 
-./decryption-filter.py <message.gpg >message.plain
+./decryption-filter.py < message.gpg > message.plain
 
 """
 
diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py
old mode 100644
new mode 100755
index f11bb25..2fd74c2
--- a/lang/python/examples/inter-edit.py
+++ b/lang/python/examples/inter-edit.py
@@ -40,10 +40,7 @@ with gpg.Context() as c:
     print("Editing key {} ({}):".format(key.uids[0].uid, key.subkeys[0].fpr))
 
     def edit_fnc(keyword, args):
-        print(
-            "Status: {}, args: {} > ".format(keyword, args),
-            end='',
-            flush=True)
+        print("Status: {}, args: {} > ".format(keyword, args), end="")
 
         if 'GET' not in keyword:
             # no prompt
diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py
old mode 100644
new mode 100755

commit ef9355c2fe8f81ccd73e0ed45ce33e925928f8e1
Author: Ben McGinnes <ben at adversary.org>
Date:   Tue Dec 25 00:18:10 2018 +1100

    python: docs processing
    
    * Added some EPUB specific config options to the Sphinx config file
      which might help reduce some of Sphinx's more stupid default errors
      with EPUB validation.
    * Added lang/python/post_installer.py script for automating the
      generation of .texi and .rst "source" files from the real source
      files written in Org mode.  Includes recreating the Sphinx Makefile
      which is excluded due to the m4 toolchain in parent directories, it
      also handles the rewriting of the reST index file properly and
      rewrites the .texi files so they don't impale themselves on Unicode.
    
    Tested-by: Ben McGinnes <ben at adversary.org>
    Signed-off-by: Ben McGinnes <ben at adversary.org>

diff --git a/lang/python/doc/rst/conf.py b/lang/python/doc/rst/conf.py
index 73ecc37..279669d 100644
--- a/lang/python/doc/rst/conf.py
+++ b/lang/python/doc/rst/conf.py
@@ -15,6 +15,8 @@
 # import os
 # import sys
 # sys.path.insert(0, os.path.abspath('.'))
+import hashlib
+import time
 
 
 # -- Project information -----------------------------------------------------
@@ -101,7 +103,7 @@ html_static_path = ['_static']
 # -- Options for HTMLHelp output ---------------------------------------------
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = 'GPGMEPythonBindingsdoc'
+htmlhelp_basename = 'GPGMEPythonBindings'
 
 
 # -- Options for LaTeX output ------------------------------------------------
@@ -114,6 +116,7 @@ latex_elements = {
     # The font size ('10pt', '11pt' or '12pt').
     #
     # 'pointsize': '10pt',
+    'pointsize': '12pt'
 
     # Additional stuff for the LaTeX preamble.
     #
@@ -128,7 +131,8 @@ latex_elements = {
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-    (master_doc, 'GPGMEPythonBindings.tex', 'GPGME Python Bindings Documentation',
+    (master_doc, 'GPGMEPythonBindings.tex',
+     'GPGME Python Bindings Documentation',
      'The GnuPG Hackers', 'manual'),
 ]
 
@@ -150,8 +154,8 @@ man_pages = [
 #  dir menu entry, description, category)
 texinfo_documents = [
     (master_doc, 'GPGMEPythonBindings', 'GPGME Python Bindings Documentation',
-     author, 'GPGMEPythonBindings', 'One line description of project.',
-     'Miscellaneous'),
+     author, 'GPGMEPythonBindings',
+     'Python Bindings to the GNU Privacy Guard API.', 'Miscellaneous'),
 ]
 
 
@@ -160,14 +164,21 @@ texinfo_documents = [
 # Bibliographic Dublin Core info.
 epub_title = project
 
-# The unique identifier of the text. This can be a ISBN number
+# The unique identifier of the text. This can be an ISBN number
 # or the project homepage.
 #
 # epub_identifier = ''
+epub_identifier = 'org.gnupg.gpgme.python'
 
 # A unique identification for the text.
 #
 # epub_uid = ''
+stt = str(time.time())
+epub_seed = "{0} {1}".format(epub_identifier, tt)
+# SHA1 would be more than fine for this, but since the dimmest always panic
+# about any use of SHA1 with GnuPG, we'll use SHA256.
+epub_hash = hashlib.sha256(epub_seed).hexdigest()
+epub_uid = 'sha256:{0}'.format(epub_hash)
 
 # A list of files that should not be packed into the epub file.
-epub_exclude_files = ['search.html']
\ No newline at end of file
+epub_exclude_files = ['search.html']
diff --git a/lang/python/post_installer.py b/lang/python/post_installer.py
new file mode 100755
index 0000000..f711589
--- /dev/null
+++ b/lang/python/post_installer.py
@@ -0,0 +1,158 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2016-2018 g10 Code GmbH
+# Copyright (C) 2015 Ben McGinnes <ben at adversary.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import glob
+import os
+import os.path
+import shutil
+import subprocess
+import sys
+import sysconfig
+
+from shutil import which
+
+del absolute_import, print_function, unicode_literals
+
+try:
+    emacs = os.path.realpath(which("emacs"))
+except TypeError as e:
+    emacs = None
+
+try:
+    makeinfo = os.path.realpath(which("makeinfo"))
+except TypeError as e:
+    makeinfo = None
+
+try:
+    pandoc = os.path.realpath(which("pandoc"))
+except TypeError as e:
+    pandoc = None
+
+try:
+    texinfo = os.path.realpath(which("texinfo"))
+except TypeError as e:
+    texinfo = None
+
+docsrc = glob.glob('doc/src/**/*', recursive=True)
+
+for srcdoc in docsrc:
+    process = subprocess.Popen([emacs, srcdoc, "--batch", "-f",
+                                "org-texinfo-export-to-texinfo", "--kill"],
+                                stdout=subprocess.PIPE)
+    procom = process.communicate()
+
+doctexi1 = glob.glob('doc/src/**/*.texi', recursive=True)
+doctexi2 = []
+doctexi3 = []
+
+for texi in doctexi1:
+    doctexi2.append(os.path.realpath(texi))
+
+for texdoc in doctexi2:
+    newtex = texdoc.replace("doc/src/", "doc/texinfo/")
+    doctexi3.append(newtex)
+    with open(texdoc, "r") as f:
+        badtex = f.read()
+    goodtex = badtex.replace("@documentencoding UTF-8\n",
+                             "@documentencoding utf-8\n")
+    with open(newtex, "w") as f:
+        f.write(goodtex)
+
+for srcdoc in docsrc:
+    rstdoc = "{0}.rst".format(srcdoc.replace("doc/src/", "doc/rst/"))
+    process = subprocess.Popen([pandoc, "-f", "org", "-t", "rst+smart", "-o",
+                                rstdoc, srcdoc], stdout=subprocess.PIPE)
+    procom = process.communicate()
+
+with open("doc/rst/index.rst", "r") as f:
+    genindex = f.readlines()
+
+indextop = ['.. GPGME Python Bindings documentation master file, created by\n',
+            '   sphinx-quickstart on Wed Dec  5 09:04:47 2018.\n',
+            '   You can adapt this file completely to your liking, but it should at least\n',
+            '   contain the root `toctree` directive.\n', '\n',
+            'GPGME Python Bindings\n', '=====================\n', '\n',
+            '.. toctree::\n', '   :maxdepth: 3\n', '   :caption: Contents:\n',
+            '\n']
+
+with open("doc/rst/index.rst", "w") as f:
+    for line in indextop:
+        f.write(line)
+    for line in genindex[5:]:
+        f.write(line)
+
+with open("doc/rst/Makefile", "w") as f:
+    f.write("""# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+SOURCEDIR     = .
+BUILDDIR      = _build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+        @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+        @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+""")
+
+print("""
+You may now generate your preferred documentation format with either Sphinx 
+or Texinfo.
+""")
+
+info_path = os.path.realpath(sysconfig._PREFIX + "/share/info")
+info_paths = os.environ["INFOPATH"].split(":")
+
+if info_paths.count(info_path) == 0:
+    info_paths.insert(0, info_path)
+else:
+    pass
+
+for ipath in info_paths:
+    if os.path.exists(os.path.realpath(ipath)) is False:
+        info_paths.remove(ipath)
+    else:
+        pass
+
+# This will very likely require root or sudo access, so running this script
+# with the same access as used to install the bindings in the first place is
+# highly recommended.
+#
+# bash variant (run in lang/python/doc/texinfo/):
+#
+# for x in *.texi:
+#     makeinfo -v --no-split $x
+# done ;
+#
+# Or to generate HTML:
+#
+# for x in *.texi:
+#     makeinfo -v --no-split --html $x
+# done ;

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

Summary of changes:
 lang/python/doc/rst/conf.py   |  23 +++++--
 lang/python/post_installer.py | 147 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+), 6 deletions(-)
 create mode 100755 lang/python/post_installer.py


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




More information about the Gnupg-commits mailing list