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

Re: Multiple problems with svn python bindings

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-08-31 21:53:05 CEST

On Sat, Aug 31, 2002 at 01:36:56AM -0500, Jon Trowbridge wrote:
> On Fri, 2002-08-30 at 16:42, Greg Stein wrote:
> > The issue here is that we need to accept a (Python) list and construct an
> > apr_array_header_t for passing into those functins. To do *that*, we need a
> > pool for that construction. So what needs to happen with those functions is
> > to somehow tell SWIG that the pool to use is "arg6" or whatever.
> Is there a way to get SWIG to do this that isn't totally abusive? I
> figured out one way, but it is so overwhelmingly hacky that I'm too
> embarrassed to mention it in public. :)

I haven't applied enough thought or investigation to the problem. I'd be
interested in seeing your hacky version. We might be able to reduce the Hack
from it :-)

> > I'm not yet sure what the cleanest approach would be for this. Hardcode it
> > for each function that takes an array? Is there some other approach?
> Hardcoding it seems like the simplest approach. It is only three
> functions, after all.

Yup. It will end up being a little more fragile than an automated approach,
but I'm not sure that we'll ever be able to truly automate this situation
(without pushing apr_array_header_t construction up to Python, which is just
wrong; any sequence ought to be fine)

> And speaking of svn_client_diff, is there a way to construct something
> in python that maps to an apr_file_t? Or do we also need to put that on
> the to-do list?

On the to-do list. Essentially, we need to get the "fileno" from the Python
file and then call apr_os_file_put() to wrap an apr_file_t around it. (the
function is awfully named and in the awfully named apr_portable.h header,
but hey... that is the guy). Then the apr_file_t is wrapped by SWIG and

Another alternative is to provide bindings for functions in apr_file_io.h. I
didn't really want to do that, however, since all languages will have their
own file manipulation systems -- we don't really need APR's. So I think just
the ability to turn a Python (true) file into apr_file_t should be fine.

I'm not sure if we need the reverse (given an apr_file_t, get a Python
file). That would involve using apr_os_file_get() and os.fdopen().

> > But for each and every callback, we need some "thunk" types of layers...
> Yeah, it looks like thunks should be pretty doable using a
> multiple-argument typemap.


> I can at least help out with the trivial bits. Attached are two (very
> small) patches: the first one fixes the crash in the svn_client_proplist
> wrapper, and the second allows the xml_src and xml_dst arguments to be
> None.

These look good. Could you go ahead and check them in with an appropriate
log message?

(technically, you do have privs, and you didn't send me a log msg :-)


Greg Stein, http://www.lyra.org/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 31 21:48:16 2002

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.