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

Re: python client for svn?

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-12-10 03:22:15 CET

On Sat, Dec 08, 2001 at 12:26:22PM -0000, Barry Scott wrote:
> I'm very interested in having Python and svn play together.
>
> I see a number of ways to do this:
>
> 1) An extension around the svn client library.

I've been working on this periodically with the SWIG stuff in the "bindings"
directory. We'll have Python bindings for the entire API (client, WC, FS,
RA, etc).

> 2) run svn via a popen() and parse the result
> 3) run svn via a popen() but tell svn to output marshaled python objects
>
> (1) avoids the parsing problem of (2) but will have to be updated each
> time the svn command changes. It has the advantage of being able to get
> at any and all features of the svn client library.

By using SWIG, the creation and maintenance of the bindings is automatic. As
we change the API, the bindings will automatically change. No manual
processes whatsoever.

Note that SWIG can also provide Perl, TCL, Guile, Ruby, and Java bindings.

In all cases, the SWIG bindings are simple covers over the functions in the
library they are wrapping. It is expected that we would then hand-craft
object-oriented covers over those.

> (2) requires only python code, but has the parsing problem.

Note that we are trying to design svn output to be machine parsable. This
approach is doable, if a bit inefficient in some cases.

>...
> > -----Original Message-----
> > From: J�rg Beyer [mailto:beyer_joerg@web.de]
> > Sent: 08 December 2001 10:51
> > To: svn-dev
> > Subject: python client for svn?
> >
> >
> > Hi,
> >
> > I am thinking about a svn python client. All I saw is the old mailing
> > list from april. Has anybody thought about a python extension that ypu could
> > do thinks like this:
> >
> > --- python code ---
> >
> > import svnclient
> >
> > myclient = svnclient("http//svn.myrepository.org")
> > s = myclient.status("/path/to/some/file")
> > ...
> > myclient.update("/path/to/another/file")
> > ...
> > myclient.import("/path/to/something/comletly different")
> > --- python code ---
> >
> > as you might have guessed, this is just to get the idea, not to fix an api.
> >
> > has anybody done any work on this, or has there been a diskussion
> > whether this will work or not?

For the Python bindings, I'm expecting to organize the modules into a
package. For example:

  import svn.client

Inside the package, the SWIG wrappers are actually named "_client". The
"client" module contains the "nice" covers over the raw library
functionality provided in the _client module.

If you're familiar with SWIG, or want to learn, then please feel free to
help out and provide patches. The SWIG .i files are located in
subversion/bindings/, although I plan to move all those to a bindings/swig/
subdirectory next time I pick that stuff up (within the next month, so I can
work on the cvs2svn converter).

Cheers,
-g

-- 
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 Oct 21 14:36:52 2006

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.