[git] GPGME - branch, master, updated. gpgme-1.11.1-122-gfc55cac

by Ben McGinnes cvs at cvs.gnupg.org
Sat Aug 18 10:21:35 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  fc55caccfc87253e1703df66b21917cc399fba62 (commit)
      from  8a6a73b9c4f92b159450edb5e4a780fc7389ca82 (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 fc55caccfc87253e1703df66b21917cc399fba62
Author: Ben McGinnes <ben at adversary.org>
Date:   Sat Aug 18 18:19:16 2018 +1000

    Python bindings setup: Near PEP8 compliance
    
    * lang/python/version.py.in: Fixed most things, but there's still an
      issue near the build portion with the existing Python bugs referenced.
    * lang/python/setup.py.in: Now PEP8 compliant.

diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 0622b61..4767e14 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2016-2017 g10 Code GmbH
+# Copyright (C) 2016-2018 g10 Code GmbH
 # Copyright (C) 2004,2008 Igor Belyi <belyi at users.sourceforge.net>
 # Copyright (C) 2002 John Goerzen <jgoerzen at complete.org>
 #
@@ -19,11 +19,14 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
 from distutils.core import setup, Extension
-import os, os.path, sys
+
 import glob
+import os
+import os.path
 import re
 import shutil
 import subprocess
+import sys
 
 # Out-of-tree build of the gpg bindings.
 gpg_error_config = ["gpg-error-config"]
@@ -40,9 +43,11 @@ top_builddir = os.environ.get("top_builddir")
 if top_builddir:
     # In-tree build.
     in_tree = True
-    gpgme_config = [os.path.join(top_builddir, "src/gpgme-config")] + gpgme_config_flags
+    gpgme_config = [os.path.join(top_builddir, "src/gpgme-config")
+                    ] + gpgme_config_flags
     gpgme_h = os.path.join(top_builddir, "src/gpgme.h")
-    library_dirs = [os.path.join(top_builddir, "src/.libs")] # XXX uses libtool internals
+    library_dirs = [os.path.join(top_builddir,
+                                 "src/.libs")]  # XXX uses libtool internals
     extra_macros.update(
         HAVE_CONFIG_H=1,
         HAVE_DATA_H=1,
@@ -55,17 +60,18 @@ else:
     devnull = open(os.devnull, "w")
 
 try:
-    subprocess.check_call(gpgme_config + ['--version'],
-                          stdout=devnull)
+    subprocess.check_call(gpgme_config + ['--version'], stdout=devnull)
 except:
     sys.exit("Could not find gpgme-config.  " +
              "Please install the libgpgme development package.")
 
+
 def getconfig(what, config=gpgme_config):
-    confdata = subprocess.Popen(config + ["--%s" % what],
-                                stdout=subprocess.PIPE).communicate()[0]
+    confdata = subprocess.Popen(
+        config + ["--%s" % what], stdout=subprocess.PIPE).communicate()[0]
     return [x for x in confdata.decode('utf-8').split() if x != '']
 
+
 version = version_raw = getconfig("version")[0]
 if '-' in version:
     version = version.split('-')[0]
@@ -90,7 +96,7 @@ for item in getconfig('cflags'):
         include_dirs.append(item[2:])
     elif item.startswith("-D"):
         defitem = item[2:].split("=", 1)
-        if len(defitem)==2:
+        if len(defitem) == 2:
             define_macros.append((defitem[0], defitem[1]))
         else:
             define_macros.append((defitem[0], None))
@@ -98,49 +104,59 @@ for item in getconfig('cflags'):
 # Adjust include and library locations in case of win32
 uname_s = os.popen("uname -s").read()
 if uname_s.startswith("MINGW32"):
-   mnts = [x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x]
-   tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts])
-   tmplist.reverse()
-   extra_dirs = []
-   for item in include_dirs:
-       for ln, mnt, tgt in tmplist:
-           if item.startswith(mnt):
-               item = os.path.normpath(item[ln:])
-               while item[0] == os.path.sep:
-                   item = item[1:]
-               extra_dirs.append(os.path.join(tgt, item))
-               break
-   include_dirs += extra_dirs
-   for item in [x[2:] for x in libs if x.startswith("-L")]:
-       for ln, mnt, tgt in tmplist:
-           if item.startswith(mnt):
-               item = os.path.normpath(item[ln:])
-               while item[0] == os.path.sep:
-                   item = item[1:]
-               library_dirs.append(os.path.join(tgt, item))
-               break
+    mnts = [
+        x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x
+    ]
+    tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts])
+    tmplist.reverse()
+    extra_dirs = []
+    for item in include_dirs:
+        for ln, mnt, tgt in tmplist:
+            if item.startswith(mnt):
+                item = os.path.normpath(item[ln:])
+                while item[0] == os.path.sep:
+                    item = item[1:]
+                extra_dirs.append(os.path.join(tgt, item))
+                break
+    include_dirs += extra_dirs
+    for item in [x[2:] for x in libs if x.startswith("-L")]:
+        for ln, mnt, tgt in tmplist:
+            if item.startswith(mnt):
+                item = os.path.normpath(item[ln:])
+                while item[0] == os.path.sep:
+                    item = item[1:]
+                library_dirs.append(os.path.join(tgt, item))
+                break
+
 
 def in_srcdir(name):
     return os.path.join(os.environ.get("srcdir", ""), name)
+
+
 def up_to_date(source, target):
-    return (os.path.exists(target)
-            and os.path.getmtime(source) <= os.path.getmtime(target))
+    return (os.path.exists(target) and
+            os.path.getmtime(source) <= os.path.getmtime(target))
+
 
 # We build an Extension using SWIG, which generates a Python module.
 # By default, the 'build_py' step is run before 'build_ext', and
 # therefore the generated Python module is not copied into the build
 # directory.
-# Bug: http://bugs.python.org/issue1016626
+# Bugs: https://bugs.python.org/issue1016626
+#       https://bugs.python.org/issue2624
 # Workaround:
-# http://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module
+# https://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module
 from distutils.command.build import build
-class BuildExtFirstHack(build):
 
+
+class BuildExtFirstHack(build):
     def _read_header(self, header, cflags):
         tmp_include = self._in_build_base("include1.h")
         with open(tmp_include, 'w') as f:
             f.write("#include <%s>" % header)
-        return subprocess.check_output(os.environ.get('CPP', 'cc -E').split() + cflags + [tmp_include]).decode('utf-8')
+        return subprocess.check_output(
+            os.environ.get('CPP', 'cc -E').split() + cflags +
+            [tmp_include]).decode('utf-8')
 
     def _write_if_unchanged(self, target, content):
         if os.path.exists(target):
@@ -158,13 +174,14 @@ class BuildExtFirstHack(build):
     def _generate_errors_i(self):
 
         try:
-            subprocess.check_call(gpg_error_config + ['--version'],
-                                  stdout=devnull)
+            subprocess.check_call(
+                gpg_error_config + ['--version'], stdout=devnull)
         except:
             sys.exit("Could not find gpg-error-config.  " +
                      "Please install the libgpg-error development package.")
 
-        gpg_error_content = self._read_header("gpg-error.h", getconfig("cflags", config=gpg_error_config))
+        gpg_error_content = self._read_header(
+            "gpg-error.h", getconfig("cflags", config=gpg_error_config))
 
         filter_re = re.compile(r'GPG_ERR_[^ ]* =')
         rewrite_re = re.compile(r' *(.*) = .*')
@@ -173,9 +190,11 @@ class BuildExtFirstHack(build):
         for line in gpg_error_content.splitlines():
             if not filter_re.search(line):
                 continue
-            errors_i_content += rewrite_re.sub(r'%constant long \1 = \1;'+'\n', line.strip())
+            errors_i_content += rewrite_re.sub(
+                r'%constant long \1 = \1;' + '\n', line.strip())
 
-        self._write_if_unchanged(self._in_build_base("errors.i"), errors_i_content)
+        self._write_if_unchanged(
+            self._in_build_base("errors.i"), errors_i_content)
 
     def _in_build_base(self, name):
         return os.path.join(self.build_base, name)
@@ -191,7 +210,8 @@ class BuildExtFirstHack(build):
         # Copy due to http://bugs.python.org/issue2624
         # Avoid creating in srcdir
         for source, target in ((in_srcdir(n), self._in_build_base(n))
-                               for n in ('gpgme.i', 'helpers.c', 'private.h', 'helpers.h')):
+                               for n in ('gpgme.i', 'helpers.c', 'private.h',
+                                         'helpers.h')):
             if not up_to_date(source, target):
                 shutil.copy2(source, target)
 
@@ -203,53 +223,60 @@ class BuildExtFirstHack(build):
     def run(self):
         self._generate()
 
-        swig_sources.extend((self._in_build_base('gpgme.i'), self._in_build_base('helpers.c')))
-        swig_opts.extend(['-I' + self.build_base,
-                          '-outdir', os.path.join(self.build_lib, 'gpg')])
+        swig_sources.extend((self._in_build_base('gpgme.i'),
+                             self._in_build_base('helpers.c')))
+        swig_opts.extend([
+            '-I' + self.build_base, '-outdir',
+            os.path.join(self.build_lib, 'gpg')
+        ])
         include_dirs.insert(0, self.build_base)
 
         self.run_command('build_ext')
         build.run(self)
 
+
 py3 = [] if sys.version_info.major < 3 else ['-py3']
 swig_sources = []
 swig_opts = ['-threads'] + py3 + extra_swig_opts
-swige = Extension("gpg._gpgme",
-                  sources = swig_sources,
-                  swig_opts = swig_opts,
-                  include_dirs = include_dirs,
-                  define_macros = define_macros,
-                  library_dirs = library_dirs,
-                  extra_link_args = libs)
-
-setup(name="gpg",
-      cmdclass={'build': BuildExtFirstHack},
-      version="@VERSION@",
-      description='Python bindings for GPGME GnuPG cryptography library',
-      # XXX add a long description
-      #long_description=long_description,
-      author='The GnuPG hackers',
-      author_email='gnupg-devel at gnupg.org',
-      url='https://www.gnupg.org',
-      ext_modules=[swige],
-      packages = ['gpg', 'gpg.constants', 'gpg.constants.data',
-                  'gpg.constants.keylist', 'gpg.constants.sig',
-                  'gpg.constants.tofu'],
-      license="LGPL2.1+ (the library), GPL2+ (tests and examples)",
-      classifiers=[
-          'Development Status :: 4 - Beta',
-          'Intended Audience :: Developers',
-          'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
-          'Programming Language :: Python :: 2',
-          'Programming Language :: Python :: 2.7',
-          'Programming Language :: Python :: 3',
-          'Programming Language :: Python :: 3.4',
-          'Programming Language :: Python :: 3.5',
-          'Programming Language :: Python :: 3.6',
-          'Programming Language :: Python :: 3.7',
-          'Operating System :: POSIX',
-          'Operating System :: Microsoft :: Windows',
-          'Topic :: Communications :: Email',
-          'Topic :: Security :: Cryptography',
-      ],
+swige = Extension(
+    "gpg._gpgme",
+    sources=swig_sources,
+    swig_opts=swig_opts,
+    include_dirs=include_dirs,
+    define_macros=define_macros,
+    library_dirs=library_dirs,
+    extra_link_args=libs)
+
+setup(
+    name="gpg",
+    cmdclass={'build': BuildExtFirstHack},
+    version="@VERSION@",
+    description='Python bindings for GPGME GnuPG cryptography library',
+    # TODO: add a long description
+    # long_description=long_description,
+    author='The GnuPG hackers',
+    author_email='gnupg-devel at gnupg.org',
+    url='https://www.gnupg.org',
+    ext_modules=[swige],
+    packages=[
+        'gpg', 'gpg.constants', 'gpg.constants.data', 'gpg.constants.keylist',
+        'gpg.constants.sig', 'gpg.constants.tofu'
+    ],
+    license="LGPL2.1+ (the library), GPL2+ (tests and examples)",
+    classifiers=[
+        'Development Status :: 4 - Beta',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Operating System :: POSIX',
+        'Operating System :: Microsoft :: Windows',
+        'Topic :: Communications :: Email',
+        'Topic :: Security :: Cryptography',
+    ],
 )
diff --git a/lang/python/version.py.in b/lang/python/version.py.in
index 1a1baf0..ad76eda 100644
--- a/lang/python/version.py.in
+++ b/lang/python/version.py.in
@@ -1,4 +1,6 @@
-# Copyright (C) 2016 g10 Code GmbH
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2016-2018 g10 Code GmbH
 # Copyright (C) 2015 Ben McGinnes <ben at adversary.org>
 # Copyright (C) 2004 Igor Belyi <belyi at users.sourceforge.net>
 #
@@ -17,10 +19,11 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
 from __future__ import absolute_import, print_function
-del absolute_import, print_function
 
 from . import gpgme
 
+del absolute_import, print_function
+
 productname = 'gpg'
 versionstr = "@VERSION@"
 gpgme_versionstr = gpgme.GPGME_VERSION
@@ -32,8 +35,8 @@ minor = versionlist[1]
 patch = versionlist[2]
 
 copyright = """\
-Copyright (C) 2016 g10 Code GmbH
-Copyright (C) 2015 Ben McGinnes
+Copyright (C) 2016-2018 g10 Code GmbH
+Copyright (C) 2015 Benjamin D. McGinnes
 Copyright (C) 2014-2015 Martin Albrecht
 Copyright (C) 2004-2008 Igor Belyi
 Copyright (C) 2002 John Goerzen"""
@@ -44,8 +47,8 @@ author_email = "gnupg-devel at gnupg.org"
 description = "Python support for GPGME GnuPG cryptography library"
 homepage = "https://gnupg.org"
 
-license = """Copyright (C) 2016 g10 Code GmbH
-Copyright (C) 2015 Ben McGinnes <ben at adversary.org>
+license = """Copyright (C) 2016-2018 g10 Code GmbH
+Copyright (C) 2015 Benjamin D. McGinnes <ben at adversary.org>
 Copyright (C) 2014, 2015 Martin Albrecht <martinralbrecht at googlemail.com>
 Copyright (C) 2004, 2008 Igor Belyi <belyi at users.sourceforge.net>
 Copyright (C) 2002 John Goerzen <jgoerzen at complete.org>

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

Summary of changes:
 lang/python/setup.py.in   | 193 ++++++++++++++++++++++++++--------------------
 lang/python/version.py.in |  15 ++--
 2 files changed, 119 insertions(+), 89 deletions(-)


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




More information about the Gnupg-commits mailing list