You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by ry...@netidea.com on 2003/04/01 00:20:28 UTC
SOLVED: Re: Problem with the svn python bindings
Hi,
Change # 5502 changed the interface to svn_fs_file_length() without changing
fs.py in the python bindings.
The latest tip of subversion crashes when I run cvs2svn.py. Not sure why,
older versions dont segfault. Also, viewcvs segfaults with the latest tip.
I think I'll be syncing backwards to 5501 to avoid these problems.
Regards,
-ryan
ryan <ry...@netidea.com> said:
> Hi,
>
> I've taken most of the weekend to install Subversion. Several problems and
> solutions:
> 1. if you want to install into /usr/local/stow instead of plain /usr/local,
> you cannot use make install to install the subprojects such as apr,
> apr-util, neon, db4. Do those seperately instead. Or use the debian
> packages for everything but neon.
> 2. While make install, do this first:
> Export LD_LIBRARY_PATH=/usr/local/stow/subversion/lib
> Export LIBRARY_PATH=/usr/local/stow/subversion/lib
>
> This worked for me.
>
> 3. make swig-py
> - had a hard time finding this out. I didn¹t read INSTALL in the
> bindings/swig directory :-)
> - make sure you already stow'ed subversion before you make install-swig-py
>
>
> Finally, I downloaded a cvs version of viewcvs, but I get this thrown python
> error:
> An Exception Has Occurred
>
> Python Traceback
>
> Traceback (most recent call last):
> File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 3037, in main
> run_viewcvs(server)
> File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 3007, in
> run_viewcvs
> view_diff(request)
> File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 2705, in view_diff
> fp = diffobj.get_pipe()
> File "/usr/local/stow/subversion/lib/svn-python/svn/fs.py", line 103, in
> get_pipe
> self.get_files()
> File "/usr/local/stow/subversion/lib/svn-python/svn/fs.py", line 84, in
> get_files
> len = file_length(self.root1, self.path1, self.pool)
> TypeError: svn_fs_file_length() takes exactly 4 arguments (3 given)
>
> I looked in the code, and indeed, this is the case... File_length() is
> giving 3 args, when 4 is expected.
>
> I looked into it, and it looks like the 3rd argument should be a char * of
> some sort, not the pool which it is now. I tried a few things, but not
> being a Python expert nor really knowing what I'm doing, I had to give up
> :-)
>
> I'm not really familiar with SWIG or Python binding, so I'm stuck.
> Hopefully someone out in svn land knows what's going on here.
>
> PS: svn rules. Good job.
>
> Regards,
> -ryan
>
>
> ---------------------------------------------------------------------
> 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
Re: SOLVED: Re: Problem with the svn python bindings
Posted by kf...@collab.net.
ryan <ry...@netidea.com> writes:
> I develeloped my Patch independently of Matt's. I'm not sure which one is
> more correct since I'm not an expert in SWIG. I really cant say for
> certain. But it does look like his does more error checking. So its
> probably better to go with his.
Thanks.
Looks like Mike Pilato did just that, in revision 5514.
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: SOLVED: Re: Problem with the svn python bindings
Posted by ryan <ry...@netidea.com>.
Hi,
I develeloped my Patch independently of Matt's. I'm not sure which one is
more correct since I'm not an expert in SWIG. I really cant say for
certain. But it does look like his does more error checking. So its
probably better to go with his.
As for where I 'got stuck', I got stuck with the interface to
svn_stream_read(). Fs.py was passing in 2 parameters, and the function
takes 3 - but 1 of the parameters is a char * buffer out. I couldn't
resolve that mismatch, so I had to give up.
Regards,
-ryan
On 4/1/03 9:01 AM, "kfogel@collab.net" <kf...@collab.net> wrote:
> ryan <ry...@netidea.com> writes:
>> 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 ** };
>
> Hmmm. Your patch is different than Matt's patch, but you clearly know
> about Matt's patch since your mail quotes it in response :-). Can you
> say why to use one rather than the other? Did Matt's patch not solve
> things for you, or is yours as effective but preferable because
> simpler?
>
>> 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.
>
> Thanks for the patches. When you say "got stuck", what were the exact
> symptoms you were seeing?
>
> -K
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: SOLVED: Re: Problem with the svn python bindings
Posted by kf...@collab.net.
ryan <ry...@netidea.com> writes:
> 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 ** };
Hmmm. Your patch is different than Matt's patch, but you clearly know
about Matt's patch since your mail quotes it in response :-). Can you
say why to use one rather than the other? Did Matt's patch not solve
things for you, or is yours as effective but preferable because
simpler?
> 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.
Thanks for the patches. When you say "got stuck", what were the exact
symptoms you were seeing?
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: SOLVED: Re: Problem with the svn python bindings
Posted by ryan <ry...@netidea.com>.
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:
> >
> > ><ry...@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
Re: SOLVED: Re: Problem with the svn python bindings
Posted by Matt Kraai <kr...@alumni.cmu.edu>.
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:
>
> ><ry...@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
Re: SOLVED: Re: Problem with the svn python bindings
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Monday, March 31, 2003, at 10:03 PM, kfogel@collab.net wrote:
> <ry...@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.
-garrett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: SOLVED: Re: Problem with the svn python bindings
Posted by kf...@collab.net.
<ry...@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?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org