[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SOLVED: Re: Problem with the svn python bindings

From: ryan <ryan_at_netidea.com>
Date: 2003-04-01 06:56:37 CEST

Hi,

I spent a bunch of more time looking into it. Matt is right, the .i
files are out of sync with the library interfaces. From my work on it,
I discovered i dont know enough about python or swig to really fix the
out of sync Python bindings. the problem is that the svn_* interface is
changing faster than the Python bindings. My solution was to use
version 0.20.1. but before I gave up I made the following fixes which
eased the problem a bit:

Index: svn_fs.i
===================================================================
--- svn_fs.i (revision 5501)
+++ svn_fs.i (working copy)
@@ -43,6 +43,10 @@
     svn_stream_t **
 };
 
+%apply long long * OUTPUT {
+ svn_filesize_t *
+};
+
 /* and this is always an OUT param */
 %apply const char **OUTPUT { const char ** };
 

But then there is a problem with the interface to svn_stream_read which
I couldn't quite resolve, but here is a first stab which converts it to
using the proper type:

Index: util.i
@@ -94,7 +95,7 @@
 /*
-----------------------------------------------------------------------
    fix up the svn_stream_read() ptr/len arguments
 */
-%typemap(python, in) (char *buffer, apr_size_t *len) ($*2_type temp) {
+%typemap(python, in) (char *buffer, svn_filesize_t *len) ($*2_type
temp) {
     if (!PyInt_Check($input)) {
         PyErr_SetString(PyExc_TypeError,
                         "expecting an integer for the buffer size");

These are all in subversion/bindings/swig

In any case, I got stuck here, and I gave up and used subversion 0.20.1,
and I got ViewCVS working in no time flat.

If anyone wants to know the secrets of installing subversion on debian
with stow, let me know :-)

Regards,
-ryan

Matt Kraai wrote:
>
> On Mon, Mar 31, 2003 at 10:48:14PM -0500, Garrett Rooney wrote:
> >
> > On Monday, March 31, 2003, at 10:03 PM, kfogel@collab.net wrote:
> >
> > ><ryan@netidea.com> writes:
> > >>Change # 5502 changed the interface to svn_fs_file_length() without
> > >>changing
> > >>fs.py in the python bindings.
> > >
> > >I'm sorry -- I thought those were automatically generated from the
> > >header files, at 'make swig-py' time. Did I miss a step?
> >
> > it looks like it's the _foo.py stuff that's autogenerated. the foo.py
> > stuff is hand coded wrappers around the generated code, if i'm reading
> > this right.
>
> I believe the following patch fixes this. Would someone please
> test it?
>
> * subversion/bindings/swig/svn_types.i: Add a typemap for
> svn_filesize_t.
>
> Index: subversion/bindings/swig/svn_types.i
> ===================================================================
> --- subversion/bindings/swig/svn_types.i (revision 5509)
> +++ subversion/bindings/swig/svn_types.i (working copy)
> @@ -103,6 +103,17 @@
> */
> %apply long *OUTPUT { svn_revnum_t * };
>
> +/* ----------------------------------------------------------------------- */
> +
> +/* Define an OUTPUT typemap for 'svn_filesize_t *'. For now, we'll
> + treat it as a 'long' even if that isn't entirely correct... */
> +
> +%typemap(python,in,numinputs=0) svn_filesize_t * (svn_filesize_t temp)
> + "$1 = &temp;";
> +
> +%typemap(python,argout,fragment="t_output_helper") svn_filesize_t *
> + "$result = t_output_helper($result,PyInt_FromLong((long) (*$1)));";
> +
> /* -----------------------------------------------------------------------
> Define a general ptr/len typemap. This takes a single script argument
> and expands it into a ptr/len pair for the native call.
>
> Matt
> --
> It's most certainly GNU/Linux, not Linux. Read more at
> http://www.gnu.org/gnu/why-gnu-linux.html.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 1 06:59:24 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.