[git] GPGME - branch, master, updated. gpgme-1.8.0-66-g30a6035

by Justus Winter cvs at cvs.gnupg.org
Tue Feb 14 12:46:16 CET 2017


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  30a603580e0f196c721fa4bd44d24077d9bc06c3 (commit)
       via  01d5c17587578c729bbbb60f8a65635975e35592 (commit)
       via  aa49be1ab80c200ab6b62d33bf5d0f5aa334fc56 (commit)
       via  d35651917097ae2eee7d52396d53d010bc34df19 (commit)
       via  d184dbbba8987d9f387feb25791ed891e108dabc (commit)
       via  fe65a26ab584bd70fad45c7c4d44330e30a748a4 (commit)
      from  60273e8b2c11d42215a5707bc55e3e0d8f350e07 (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 30a603580e0f196c721fa4bd44d24077d9bc06c3
Author: Justus Winter <justus at g10code.com>
Date:   Tue Feb 14 12:45:15 2017 +0100

    qt: Make sure to remove the tofu.db on clean.
    
    * lang/qt/tests/Makefile.am (CLEANFILES): Add 'tofu.db'.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index e3aa3be..93dce07 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -72,7 +72,7 @@ noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \
 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
 	gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
 	random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp $(moc_files) \
-	gpg.conf
+	gpg.conf tofu.db
 
 clean-local:
 	-rm -fR  private-keys-v1.d crls.d

commit 01d5c17587578c729bbbb60f8a65635975e35592
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Dec 20 18:02:36 2016 +0100

    python: Extend SWIG gpgme_{sub,}key with a __repr__ method.
    
    * lang/python/gpgme.i: Added a genericrepr macro and use it for
    gpgme_key, gpgme_subkey, and gpgme_key_sig.
    --
    
    To look nicer in Python's REPL.
    
    We define a generic __repr__ as a SWIG macro and use that to extend some
    defined SWIG objects.
    
    The alternative would have been to write a custom __repr__ function for
    each class but that would need to be changed everytime the object's
    structure changes. The bindings should be easy to maintain, I guess.
    This comes at the expense that the reprs are now relatively long and
    contain, for example, both keyid and fingerprint.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index e21aa6c..c0993ee 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -649,3 +649,30 @@ _gpg_unwrap_gpgme_ctx_t(PyObject *wrapped)
 /* ... but only the public definitions here.  They will be exposed to
    the Python world, so let's be careful.  */
 %include "helpers.h"
+
+
+%define genericrepr(cls)
+%pythoncode %{
+    def __repr__(self):
+        names = [name for name in dir(self)
+            if not name.startswith("_") and name != "this"]
+        props = ", ".join(("{}={!r}".format(name, getattr(self, name))
+            for name in names)
+        )
+        return "cls({})".format(props)
+%}
+
+%enddef
+
+%extend _gpgme_key {
+  genericrepr(Key)
+};
+
+
+%extend _gpgme_subkey {
+  genericrepr(SubKey)
+};
+
+%extend _gpgme_key_sig {
+  genericrepr(KeySig)
+};

commit aa49be1ab80c200ab6b62d33bf5d0f5aa334fc56
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Dec 20 18:02:20 2016 +0100

    python: Remove the -builtin flag for SWIG.
    
    * lang/python/setup.py.in: Call SWIG without the builtin flag.
    --
    
    The SWIG documentation
    <http://www.swig.org/Doc2.0/Python.html#Python_nn28> leaves the
    impression that -builtin is solely for increasing performance:
    
        New in SWIG version 2.0.4: The use of Python proxy classes has
        performance implications that may be unacceptable for a high-
        performance library. The new -builtin option instructs SWIG to
        forego the use of proxy classes, and instead create wrapped types as
        new built-in Python types. When this option is used, the following
        section ("Proxy classes") does not apply. Details on the use of the
        -builtin option are in the Built-in Types section.
    
    While not wasting CPU cycles is good, it also prevents Python code being
    written in the wrapper itself. That, however, may be useful to make it
    easier to extend the wrapper.
    
    Partially reverts: 856bcfe2934237011984fab0bc69800a7c25c34b
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index c7f981a..5b5d5be 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -154,7 +154,7 @@ class BuildExtFirstHack(build):
 
 py3 = [] if sys.version_info.major < 3 else ['-py3']
 swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
-                  swig_opts = ['-threads', '-builtin',
+                  swig_opts = ['-threads',
                                '-outdir', 'gpg'] + py3 + extra_swig_opts,
                   include_dirs = include_dirs,
                   define_macros = define_macros,

commit d35651917097ae2eee7d52396d53d010bc34df19
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Dec 20 18:01:27 2016 +0100

    python: Call SWIG_NewPointerObj rather than SWIG_Python_NewPointerObj.
    
    * lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Provide a "self"
    variable for SWIG_NewPointerObj and call SWIG_NewPointerObj rather than
    SWIG_Python_NewPointerObj.
    --
    
    SWIG_Python_NewPointerObj seems to be an implementation detail, because
    SWIG's documentation does not mention that function at all.  In fact,
    SWIG_NewPointerObj is a call to SWIG_Python_NewPointerObj with the first
    parameter being either NULL or the "self" variable, depending on whether
    SWIG is called with the -builtin flag.  So far, the first parameter was
    hard-coded to NULL.  This change also hard-codes it to NULL but makes
    it more explicit.  The benefit is that the documented function is being
    used and that compilation works regardless of the -builtin flag.
    
    Partially reverts: 856bcfe2934237011984fab0bc69800a7c25c34b
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index c7d89db..e21aa6c 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -620,7 +620,17 @@ FILE *fdopen(int fildes, const char *mode);
 PyObject *
 _gpg_wrap_gpgme_data_t(gpgme_data_t data)
 {
-  return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0);
+  /*
+   * If SWIG is invoked without -builtin, the macro SWIG_NewPointerObj
+   * expects a variable named "self".
+   *
+   * XXX: It is not quite clear why passing NULL as self is okay, but
+   * it works with -builtin, and it seems to work just fine without
+   * it too.
+   */
+  PyObject* self = NULL;
+  (void) self;
+  return SWIG_NewPointerObj(data, SWIGTYPE_p_gpgme_data, 0);
 }
 
 gpgme_ctx_t

commit d184dbbba8987d9f387feb25791ed891e108dabc
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Tue Dec 20 18:00:36 2016 +0100

    python: Conditionally provide py3 argument to SWIG
    
    * lang/python/setup.py.in: Only call with -py3 when we run under python3
    or higher.
    --
    
    If we ever remove the -builtin flag and leave the the -py3 flag, SWIG
    will generate Python code which will be incompatible with Python 2,
    because the py3 flag generates python3 code which is incompatible with
    python2.
    
    So we conditionally generate SWIG bindings with -py3.
    
    Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>

diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 9669c28..c7f981a 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -152,9 +152,10 @@ class BuildExtFirstHack(build):
         self.run_command('build_ext')
         build.run(self)
 
+py3 = [] if sys.version_info.major < 3 else ['-py3']
 swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
-                  swig_opts = ['-py3', '-builtin', '-threads',
-                               '-outdir', 'gpg'] + extra_swig_opts,
+                  swig_opts = ['-threads', '-builtin',
+                               '-outdir', 'gpg'] + py3 + extra_swig_opts,
                   include_dirs = include_dirs,
                   define_macros = define_macros,
                   library_dirs = library_dirs,

commit fe65a26ab584bd70fad45c7c4d44330e30a748a4
Author: Justus Winter <justus at g10code.com>
Date:   Mon Feb 13 16:44:53 2017 +0100

    python: Use one copy of the source tree per Python version.
    
    * lang/python/Makefile.am (copystamp): Create one copy per Python
    version.
    (all-local): Adapt.
    (clean-local): Likewise.
    (install-exec-local): Likewise.
    * lang/python/tests/run-tests.py: Likewise.
    --
    
    Currently, we use one copy of the Python module's source to build for
    all Python versions.  This is problematic, because SWIG writes a
    wrapper file into the source tree.  Currently, this file works with
    both Python 2 and 3, but this is purely by chance.
    
    Improve the situation by creating one copy per Python version so that
    SWIG can write version-specific code into each copy.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index e32fd12..908f622 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -47,10 +47,12 @@ COPY_FILES_GPG = \
 # For VPATH builds we need to copy some files because Python's
 # distutils are not VPATH-aware.
 copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
-	if test "$(srcdir)" != "$(builddir)" ; then \
-	  cp -R $(COPY_FILES) . ; \
-	  cp -R $(COPY_FILES_GPG) gpg ; \
-	fi
+	for VERSION in $(PYTHON_VERSIONS); do \
+	  $(MKDIR_P)              python$${VERSION}-gpg/gpg && \
+	  cp -R $(COPY_FILES)     python$${VERSION}-gpg && \
+	  cp gpg/version.py       python$${VERSION}-gpg/gpg && \
+	  cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \
+	done
 	touch $@
 
 data.h:
@@ -60,9 +62,12 @@ config.h:
 	ln -s "$(top_builddir)/config.h" .
 
 all-local: copystamp
-	for PYTHON in $(PYTHONS); do \
+	set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
+	  PYTHON="$$1" ; shift ; \
+	  cd python$${VERSION}-gpg && \
 	  CFLAGS="$(CFLAGS)" \
-	    $$PYTHON setup.py build --verbose ; \
+	    $$PYTHON ../setup.py build --verbose ; \
+	  cd .. ; \
 	done
 
 dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
@@ -89,23 +94,23 @@ CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
 # permissions.
 clean-local:
 	rm -rf -- build
-	if test "$(srcdir)" != "$(builddir)" ; then \
-	  find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
-	  for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
-	  for F in $(COPY_FILES_GPG); do \
-	      rm -rf -- gpg/`basename $$F` ; \
-	  done ; \
-	fi
+	for VERSION in $(PYTHON_VERSIONS); do \
+	  find python$${VERSION}-gpg -type d ! -perm -200 -exec chmod u+w {} ';' ; \
+	  rm -rf -- python$${VERSION}-gpg ; \
+	done
 
 install-exec-local:
 	rm -f install_files.txt
-	for PYTHON in $(PYTHONS); do \
-	  $$PYTHON setup.py install \
+	set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
+	  PYTHON="$$1" ; shift ; \
+	  cd python$${VERSION}-gpg && \
+	  $$PYTHON ../setup.py install \
 	  --prefix $(DESTDIR)$(prefix) \
 	  --record files.txt \
 	  --verbose ; \
-	  cat files.txt >> install_files.txt ; \
+	  cat files.txt >> ../install_files.txt ; \
 	  rm files.txt ; \
+	  cd .. ; \
 	done
 	$(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
 	mv install_files.txt $(DESTDIR)$(pythondir)/gpg
diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py
index 46c6d8c..e76acb2 100644
--- a/lang/python/tests/run-tests.py
+++ b/lang/python/tests/run-tests.py
@@ -69,7 +69,9 @@ for interpreter in args.interpreters:
     version = subprocess.check_output(
         [interpreter, "-c", "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"]).strip().decode()
 
-    builddirs = glob.glob(os.path.join(args.builddir, "..", "build",
+    builddirs = glob.glob(os.path.join(args.builddir, "..",
+                                       "python{0}-gpg".format(version),
+                                       "build",
                                        "lib*"+version))
     assert len(builddirs) == 1, \
         "Expected one build directory, got {0}".format(builddirs)

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

Summary of changes:
 lang/python/Makefile.am        | 37 +++++++++++++++++++++----------------
 lang/python/gpgme.i            | 39 ++++++++++++++++++++++++++++++++++++++-
 lang/python/setup.py.in        |  5 +++--
 lang/python/tests/run-tests.py |  4 +++-
 lang/qt/tests/Makefile.am      |  2 +-
 5 files changed, 66 insertions(+), 21 deletions(-)


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




More information about the Gnupg-commits mailing list