[git] GPGME - branch, master, updated. gpgme-1.7.0-17-gc9934bb

by Justus Winter cvs at cvs.gnupg.org
Mon Sep 26 16:58:37 CEST 2016


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  c9934bb1eecae28abeb361db9f5eb73e7e02ecb6 (commit)
       via  c38fabfea0601ed5f61e27e0bf43f8e74c67ce2a (commit)
       via  1d80e7374aa3150306c86afe7acdc8e8eb05143f (commit)
       via  3703a4723899d7563937b4b99f5bbe4dd8d3dfed (commit)
      from  95f38652f696476b38a040644eac40b4511d2b32 (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 c9934bb1eecae28abeb361db9f5eb73e7e02ecb6
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 26 16:45:21 2016 +0200

    python: Get rid of the last C++-style comments.
    
    --
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 04257fd..eaeb4f8 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -110,7 +110,7 @@
     Py_XDECREF(pyVector$argnum[i]);
 }
 
-// Release returned buffers as necessary.
+/* Release returned buffers as necessary.  */
 %typemap(newfree) char * "free($1);";
 %newobject gpgme_data_release_and_get_mem;
 
@@ -133,7 +133,7 @@
       /* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
       /* &1_descriptor = $&1_descriptor *1_descriptor = $*1_descriptor */
 
-      // Following code is from swig's python.swg
+      /* Following code is from swig's python.swg.  */
       if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) {
 	Py_DECREF(pypointer);
 	return NULL;
@@ -147,7 +147,7 @@
   if ($1) free($1);
 }
 
-// Special handling for references to our objects.
+/* Special handling for references to our objects.  */
 %typemap(in) gpgme_data_t DATAIN (gpgme_data_t wrapper = NULL,
                                   PyObject *bytesio = NULL,
                                   Py_buffer view, int have_view = 0) {
@@ -167,7 +167,7 @@
 
     /* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
 
-    // Following code is from swig's python.swg
+    /* Following code is from swig's python.swg.  */
 
     if ((SWIG_ConvertPtr(pypointer,(void **) &$1, $1_descriptor,
          SWIG_POINTER_EXCEPTION | $disown )) == -1) {
@@ -401,7 +401,7 @@
   Py_XDECREF(encodedInput$argnum);
 }
 
-// Make types containing 'next' field to be lists
+/* Make types containing 'next' field to be lists.  */
 %ignore next;
 %typemap(out) gpgme_sig_notation_t, gpgme_subkey_t,
    gpgme_key_sig_t, gpgme_user_id_t, gpgme_invalid_key_t,
@@ -631,7 +631,7 @@ struct _gpgme_sig_notation
 
 %include "errors.i"
 
-// Generating and handling pointers-to-pointers.
+/* Generating and handling pointers-to-pointers.  */
 
 %pointer_functions(gpgme_ctx_t, gpgme_ctx_t_p);
 %pointer_functions(gpgme_data_t, gpgme_data_t_p);
@@ -640,7 +640,7 @@ struct _gpgme_sig_notation
 %pointer_functions(gpgme_trust_item_t, gpgme_trust_item_t_p);
 %pointer_functions(gpgme_engine_info_t, gpgme_engine_info_t_p);
 
-// Helper functions.
+/* Helper functions.  */
 
 %{
 #include <stdio.h>

commit c38fabfea0601ed5f61e27e0bf43f8e74c67ce2a
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 26 13:16:59 2016 +0200

    python: Correctly translate to size_t.
    
    * lang/python/gpgme.i: Correctly translate Python number to size_t.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 934ebea..04257fd 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -329,14 +329,29 @@
     PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
 }
 
-// Those are for gpgme_data_read() and gpgme_strerror_r()
+/* Those are for gpgme_data_read() and gpgme_strerror_r().  */
 %typemap(in) (void *buffer, size_t size), (char *buf, size_t buflen) {
-   $2 = PyLong_AsLong($input);
-   if ($2 < 0) {
-     PyErr_SetString(PyExc_ValueError, "Positive integer expected");
-     return NULL;
-   }
-   $1 = ($1_ltype) malloc($2+1);
+  {
+    long tmp$argnum;
+    if (PyLong_Check($input))
+      tmp$argnum = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+    else if (PyInt_Check($input))
+      tmp$argnum = PyInt_AsLong($input);
+#endif
+    else
+      {
+        PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+        return NULL;
+      }
+
+    if (tmp$argnum < 0) {
+      PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+      return NULL;
+    }
+    $2 = (size_t) tmp$argnum;
+    $1 = ($1_ltype) malloc($2+1);
+  }
 }
 %typemap(argout) (void *buffer, size_t size), (char *buf, size_t buflen) {
   Py_XDECREF($result);   /* Blow away any previous result */

commit 1d80e7374aa3150306c86afe7acdc8e8eb05143f
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 26 13:04:35 2016 +0200

    python: Correctly translate off_t.
    
    * lang/python/gpgme.i: Improve int/long translations, correctly handle
    off_t with large file support.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index a4672e1..934ebea 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -291,13 +291,42 @@
 
 /* SWIG has problems interpreting ssize_t, off_t or gpgme_error_t in
    gpgme.h.  */
-/* XXX: This is wrong at least for off_t if compiled with LFS.  */
-%typemap(out) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+%typemap(out) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
   $result = PyLong_FromLong($1);
 }
-/* XXX: This is wrong at least for off_t if compiled with LFS.  */
-%typemap(in) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
-  $1 = PyLong_AsLong($input);
+
+%typemap(in) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+  if (PyLong_Check($input))
+    $1 = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+  else if (PyInt_Check($input))
+    $1 = PyInt_AsLong($input);
+#endif
+  else
+    PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+}
+
+%typemap(out) off_t {
+#if _FILE_OFFSET_BITS == 64
+  $result = PyLong_FromLongLong($1);
+#else
+  $result = PyLong_FromLong($1);
+#endif
+}
+
+%typemap(in) off_t {
+  if (PyLong_Check($input))
+#if _FILE_OFFSET_BITS == 64
+    $1 = PyLong_AsLongLong($input);
+#else
+    $1 = PyLong_AsLong($input);
+#endif
+#if PY_MAJOR_VERSION < 3
+  else if (PyInt_Check($input))
+    $1 = PyInt_AsLong($input);
+#endif
+  else
+    PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
 }
 
 // Those are for gpgme_data_read() and gpgme_strerror_r()

commit 3703a4723899d7563937b4b99f5bbe4dd8d3dfed
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 26 11:35:40 2016 +0200

    python: Include 'config.h'.
    
    * lang/python/Makefile.am: Pass 'top_builddir' to 'setup.py'.
    * lang/python/gpgme.i: Include 'config.h'.
    * lang/python/helpers.c: Likewise.
    * lang/python/helpers.h: Likewise.
    * lang/python/setup.py.in: Make sure that 'config.h' can be found.
    --
    Fixes build on 32 bit platforms with large file support.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 2271ce0..1d7aee8 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -56,6 +56,7 @@ copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
 all-local: copystamp
 	for PYTHON in $(PYTHONS); do \
 	  CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+	  top_builddir="$(top_builddir)" \
 	    $$PYTHON setup.py build --verbose ; \
 	done
 
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 84addae..a4672e1 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -547,6 +547,10 @@
    some structs, which we provide prior to including the version for
    SWIG.  */
 %{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <gpgme.h>
 %}
 
@@ -575,6 +579,10 @@ struct _gpgme_sig_notation
 
 /* Now include our local modified version.  Any structs defined above
    are ignored.  */
+#ifdef HAVE_CONFIG_H
+%include "config.h"
+#endif
+
 %include "gpgme.h"
 
 %include "errors.i"
diff --git a/lang/python/helpers.c b/lang/python/helpers.c
index f9aec91..3724752 100644
--- a/lang/python/helpers.c
+++ b/lang/python/helpers.c
@@ -18,6 +18,10 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <assert.h>
 #include <stdio.h>
 #include <gpgme.h>
diff --git a/lang/python/helpers.h b/lang/python/helpers.h
index 9200f93..67d23b2 100644
--- a/lang/python/helpers.h
+++ b/lang/python/helpers.h
@@ -18,6 +18,10 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <gpgme.h>
 #include "Python.h"
 
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 31892c1..7af2d48 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -28,6 +28,7 @@ gpg_error_config = ["gpg-error-config"]
 gpgme_config_flags = ["--thread=pthread"]
 gpgme_config = ["gpgme-config"] + gpgme_config_flags
 gpgme_h = ""
+include_dirs = [os.getcwd()]
 library_dirs = []
 in_tree = False
 extra_swig_opts = []
@@ -38,8 +39,13 @@ if os.path.exists("../../src/gpgme-config"):
     in_tree = True
     gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags
     gpgme_h = "../../src/gpgme.h"
+    if 'top_builddir' in os.environ:
+        include_dirs.append(os.environ['top_builddir'])
+        # Make sure that SWIG finds config.h when processing gpgme.i.
+        extra_swig_opts.append("-I{0}".format(os.environ['top_builddir']))
     library_dirs = ["../../src/.libs"] # XXX uses libtool internals
     extra_macros.update(
+        HAVE_CONFIG_H=1,
         HAVE_DATA_H=1,
         IN_TREE_BUILD=1,
     )
@@ -94,7 +100,6 @@ subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
 subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpg_error_h],
                       stdout=open("errors.i", "w"))
 
-include_dirs = [os.getcwd()]
 define_macros = []
 libs = getconfig('libs')
 

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

Summary of changes:
 lang/python/Makefile.am |  1 +
 lang/python/gpgme.i     | 90 ++++++++++++++++++++++++++++++++++++++-----------
 lang/python/helpers.c   |  4 +++
 lang/python/helpers.h   |  4 +++
 lang/python/setup.py.in |  7 +++-
 5 files changed, 86 insertions(+), 20 deletions(-)


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




More information about the Gnupg-commits mailing list