You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Joerg Hessdoerfer <Jo...@sea-gmbh.com> on 2005/02/12 00:45:52 UTC

Is there any doc for python SWIG bindings?

Hi,

I face the task of writing a very specialised svn client. I thought I'd stick 
with python, but I can't find any docs for the SWIG bindings. At least an 
argument list for each function would be very helpful!

I just can't find out what to send 'svn_client_status', for example. I just 
get all kinds of argument errors. Can anyone point me in the right direction?

Thanks,
 Jörg
-- 
Leading SW developer  - S.E.A GmbH
Mail: joerg.hessdoerfer@sea-gmbh.com
WWW:  http://www.sea-gmbh.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Barry Scott <ba...@barrys-emacs.org>.
>> I may be somewhat biased here, but I can't really make out any sense 
>> in
>> 'alternative' binding implementations. If the 'originals' are buggy, 
>> try to
>> fix it. If they don't expose all functionality, add it. If they are 
>> clumsy to
>> use, add a wrapper.
>
> I agree with the sentiment, though I can take a pretty good guess at 
> why pysvn exists as it is: SWIG is nastily complex to learn.
>
> PySVN wraps much less of the API than the SWIG-Python bindings do, but 
> does it in a higher level (and documented) way - it's all about 
> tradeoffs, really.
>
> Max.

Spot on Max.

 From the pysvn FAQ

3. What's wrong with the subversion python bindings?
The subversion python binds have a number of problems:

     * they are not object oriented or python like
     * they are low level, about 650 functions and 70 structs
     * users end up read the Subverison C header files to learn usage

4. Why don't you use SWIG to wrap an svn API?
Using PyCXX a python like interface is easy to implement. To achieve 
the same interface with SWIG is a lot harder.

I will be adding the svnlook functionality next. I've not been asked 
for, or personally required, anything other
then client API and the svnlook API for use in hook procedures.

Barry


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Max Bowsher <ma...@ukf.net>.
Joerg Hessdoerfer wrote:
> Hi,
>
> On Sunday 20 February 2005 19:29, Barry Scott wrote:
>> You might find pysvn easier to use the the swig bindings.
>> They cannot cause a segv and are documented.
>>
>> http://pysvn.tigris.org/
>>
>> Barry
> [...]
>
> thanks for the suggestion, but I'd rather stick to the originals, because 
> I'm
> not convinced all functionality is and will be in second-source bindings. 
> Is
> there any reason the pysvn code doesn't use the SWIG bindings internally? 
> In
> this way one could more easily customize them or add missing features.
> Additionally, that's just another package to install, another shared lib 
> and
> thus another can of worms.
>
> I may be somewhat biased here, but I can't really make out any sense in
> 'alternative' binding implementations. If the 'originals' are buggy, try 
> to
> fix it. If they don't expose all functionality, add it. If they are clumsy 
> to
> use, add a wrapper.

I agree with the sentiment, though I can take a pretty good guess at why 
pysvn exists as it is: SWIG is nastily complex to learn.

PySVN wraps much less of the API than the SWIG-Python bindings do, but does 
it in a higher level (and documented) way - it's all about tradeoffs, 
really.

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Joerg Hessdoerfer <Jo...@sea-gmbh.com>.
Hi,

On Sunday 20 February 2005 19:29, Barry Scott wrote:
> You might find pysvn easier to use the the swig bindings.
> They cannot cause a segv and are documented.
>
> http://pysvn.tigris.org/
>
> Barry
[...]

thanks for the suggestion, but I'd rather stick to the originals, because I'm 
not convinced all functionality is and will be in second-source bindings. Is 
there any reason the pysvn code doesn't use the SWIG bindings internally? In 
this way one could more easily customize them or add missing features.
Additionally, that's just another package to install, another shared lib and 
thus another can of worms.

I may be somewhat biased here, but I can't really make out any sense in 
'alternative' binding implementations. If the 'originals' are buggy, try to 
fix it. If they don't expose all functionality, add it. If they are clumsy to 
use, add a wrapper.

Thanks anyway,
 Jörg
-- 
Leading SW developer  - S.E.A GmbH
Mail: joerg.hessdoerfer@sea-gmbh.com
WWW:  http://www.sea-gmbh.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Barry Scott <ba...@barrys-emacs.org>.
You might find pysvn easier to use the the swig bindings.
They cannot cause a segv and are documented.

http://pysvn.tigris.org/

Barry

On Feb 12, 2005, at 16:11, Joerg Hessdoerfer wrote:

> Hi,
>
> On Saturday 12 February 2005 02:11, Max Bowsher wrote:
>> Joerg Hessdoerfer wrote:
>>> Hi,
>>>
>>> I face the task of writing a very specialised svn client. I thought  
>>> I'd
>>> stick
>>> with python, but I can't find any docs for the SWIG bindings. At  
>>> least an
>>> argument list for each function would be very helpful!
>>>
>>> I just can't find out what to send 'svn_client_status', for example.  
>>> I
>>> just
>>> get all kinds of argument errors. Can anyone point me in the right
>>> direction?
>>
>> http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ 
>> python/READM
>> E
>>
>> Max.
>>
>
> Thank you, this helped a lot. I now can get status information for a  
> wc, using
>
> def callback(path, status):
>  print path, (...)
>
> svn_client_status(path, None, callback, 1, 0, 0, 0,ctx,pool)
>
> but, when I try to use 'update = 1', I get a 'Segmentation fault'. I  
> reckoned
> I needed the revision arg, so I did:
>
> rev = util.svn_opt_revision_t
> rev.kind = util.svn_opt_revision_head
> client.svn_client_status(path, rev, callback, 1, 0, 1, 0, ctx, pool)
>
> ...and it says 'TypeError: Expected a pointer'.
>
> I also tried
>
> client.svn_client_status(path, util.svn_opt_revision_tPtr(rev),  
> callback, 1,
> 0, 0, 0, ctx, pool)
>
> but still, 'TypeError: Expected a pointer'.
>
> How does one pass the revision argument? (Or how does one create a SWIG
> pointer'ed argument?)
>
> Thanks,
>  Jörg
> -- 
> Leading SW developer  - S.E.A GmbH
> Mail: joerg.hessdoerfer@sea-gmbh.com
> WWW:  http://www.sea-gmbh.com
>
> ---------------------------------------------------------------------
> 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: Is there any doc for python SWIG bindings?

Posted by Max Bowsher <ma...@ukf.net>.
Joerg Hessdoerfer wrote:
> Hi,
>
> On Saturday 12 February 2005 21:03, Max Bowsher wrote:
>> Joerg Hessdoerfer wrote:
> [...]
>>> How does one pass the revision argument? (Or how does one create a SWIG
>>> pointer'ed argument?)
>>
>> I've attached some demo code I've been slowly building.
>> Hopefully, that can help.
>>
>> Max.
>
> Yeah, this was way cool and helped a lot. I just ran it on one of my
> repos,
> and it worked fine.
>
> Thanks again, this will get me started!
> Jörg
>
> P.s.: I really think something like this should be in the examples, what
> do
> you think?

Indeed - that's what I'm writing it for. It's not exactly finished, though - 
even the status example wasn't written until you asked about it.

Max. 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Joerg Hessdoerfer <Jo...@sea-gmbh.com>.
Hi,

On Saturday 12 February 2005 21:03, Max Bowsher wrote:
> Joerg Hessdoerfer wrote:
[...]
> > How does one pass the revision argument? (Or how does one create a SWIG
> > pointer'ed argument?)
>
> I've attached some demo code I've been slowly building.
> Hopefully, that can help.
>
> Max.

Yeah, this was way cool and helped a lot. I just ran it on one of my repos, 
and it worked fine.

Thanks again, this will get me started!
 Jörg

P.s.: I really think something like this should be in the examples, what do 
you think?
-- 
Leading SW developer  - S.E.A GmbH
Mail: joerg.hessdoerfer@sea-gmbh.com
WWW:  http://www.sea-gmbh.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Max Bowsher <ma...@ukf.net>.
Joerg Hessdoerfer wrote:
> Hi,
>
> On Saturday 12 February 2005 02:11, Max Bowsher wrote:
>> Joerg Hessdoerfer wrote:
>>> Hi,
>>>
>>> I face the task of writing a very specialised svn client. I thought I'd
>>> stick
>>> with python, but I can't find any docs for the SWIG bindings. At least 
>>> an
>>> argument list for each function would be very helpful!
>>>
>>> I just can't find out what to send 'svn_client_status', for example. I
>>> just
>>> get all kinds of argument errors. Can anyone point me in the right
>>> direction?
>>
>> http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/python/READM
>> E
>>
>> Max.
>>
>
> Thank you, this helped a lot. I now can get status information for a wc, 
> using
>
> def callback(path, status):
> print path, (...)
>
> svn_client_status(path, None, callback, 1, 0, 0, 0,ctx,pool)
>
> but, when I try to use 'update = 1', I get a 'Segmentation fault'. I 
> reckoned
> I needed the revision arg, so I did:
>
> rev = util.svn_opt_revision_t
> rev.kind = util.svn_opt_revision_head
> client.svn_client_status(path, rev, callback, 1, 0, 1, 0, ctx, pool)
>
> ...and it says 'TypeError: Expected a pointer'.
>
> I also tried
>
> client.svn_client_status(path, util.svn_opt_revision_tPtr(rev), callback, 
> 1,
> 0, 0, 0, ctx, pool)
>
> but still, 'TypeError: Expected a pointer'.
>
> How does one pass the revision argument? (Or how does one create a SWIG
> pointer'ed argument?)

I've attached some demo code I've been slowly building.
Hopefully, that can help.

Max.

Re: Is there any doc for python SWIG bindings?

Posted by Joerg Hessdoerfer <Jo...@sea-gmbh.com>.
Hi,

On Saturday 12 February 2005 02:11, Max Bowsher wrote:
> Joerg Hessdoerfer wrote:
> > Hi,
> >
> > I face the task of writing a very specialised svn client. I thought I'd
> > stick
> > with python, but I can't find any docs for the SWIG bindings. At least an
> > argument list for each function would be very helpful!
> >
> > I just can't find out what to send 'svn_client_status', for example. I
> > just
> > get all kinds of argument errors. Can anyone point me in the right
> > direction?
>
> http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/python/READM
>E
>
> Max.
>

Thank you, this helped a lot. I now can get status information for a wc, using

def callback(path, status):
 print path, (...)

svn_client_status(path, None, callback, 1, 0, 0, 0,ctx,pool)

but, when I try to use 'update = 1', I get a 'Segmentation fault'. I reckoned 
I needed the revision arg, so I did:

rev = util.svn_opt_revision_t
rev.kind = util.svn_opt_revision_head
client.svn_client_status(path, rev, callback, 1, 0, 1, 0, ctx, pool)

...and it says 'TypeError: Expected a pointer'.

I also tried 

client.svn_client_status(path, util.svn_opt_revision_tPtr(rev), callback, 1, 
0, 0, 0, ctx, pool)

but still, 'TypeError: Expected a pointer'.

How does one pass the revision argument? (Or how does one create a SWIG 
pointer'ed argument?)

Thanks,
 Jörg
-- 
Leading SW developer  - S.E.A GmbH
Mail: joerg.hessdoerfer@sea-gmbh.com
WWW:  http://www.sea-gmbh.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Is there any doc for python SWIG bindings?

Posted by Max Bowsher <ma...@ukf.net>.
Joerg Hessdoerfer wrote:
> Hi,
>
> I face the task of writing a very specialised svn client. I thought I'd 
> stick
> with python, but I can't find any docs for the SWIG bindings. At least an
> argument list for each function would be very helpful!
>
> I just can't find out what to send 'svn_client_status', for example. I 
> just
> get all kinds of argument errors. Can anyone point me in the right 
> direction?

http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/python/README

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org