You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philipp von Weitershausen <ph...@weitershausen.de> on 2003/05/13 21:36:14 UTC

[PATCH] SWIG bindings refactoring (esp. python)

My goal is to make the SWIG bindings to python as easy to use and as 
pythonic as possible. The following patch is a result of the previous 
discussion with cmpilato and Greg Stein ("eliminate -noproxy flat to SWIG").

When this patch is applied, all python code should still run unless it 
uses accessor functions. Instead of using accessor functions, you can 
now simply acquire the attribute of your struct wrapping object to 
acquire a struct member (e.g. ctx.auth_baton instead of 
svn_client_ctx_t_auth_baton_get(ctx).).

Log Message:

* Makefile.in
   subversion/bindings/swig/*.i
   - Do not call SWIG with the -noproxy flag: build shadow classes
     instead of accessor functions for structs.
   - The pure SWIG bindings are available as the 'libsvn' package while
     the 'svn' package provides extra auxiliary classes and functions
     for the python programmer.

* subversion/bindings/swig/python/__init__.py
   Added file to repository. It makes 'libsvn' a package.

* build.conf
   subversion/bindings/swig/util.i
   subversion/bindings/swig/core.i
   Renamed the 'util' module to 'core' since it does not provide simple
   utilities but core funtionality. Importing 'util' still works for
   compatability reasons, but be aware that this is likely to go away in
   the future.

* tools/*.py
   Make use of the changes above:
   - Use 'core' module instead of 'util'. 'util' is depecreated.
   - Use attributes instead of accessor functions.

Re: [PATCH] SWIG bindings refactoring (esp. python)

Posted by cm...@collab.net.
Philipp von Weitershausen <ph...@weitershausen.de> writes:

> My goal is to make the SWIG bindings to python as easy to use and as
> pythonic as possible. The following patch is a result of the previous
> discussion with cmpilato and Greg Stein ("eliminate -noproxy flat to
> SWIG").

Reviewing for commit now (sorry for the delay).

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

Re: [PATCH] SWIG bindings refactoring (esp. python)

Posted by Philipp von Weitershausen <ph...@weitershausen.de>.
So, what about the patch? Will you or somebody else apply it? 'Cause I 
have some more code waiting to be contributed...

Phil

Philipp von Weitershausen wrote:
> Greg Stein wrote:
> 
>> +1 on the patch concept and from a simple review. I haven't applied and
>> tested, however.
>>
>> -0 on the changes to the SWIG invocation for Java. I'm not sure they are
>> ready or want the proxies (yet).
> 
> 
> Ok. I guess I was a little too ambitious here. Do you want me to send an 
> updated version of the patch?
> 
>> In a future change, I'd like to see a swig/python/libsvn/ subdir cuz 
>> I'm not
>> too cozy with the __init__.py addition (but it is fine for now). That 
>> would
>> alter the copying strategy (and I don't think we want to build in the 
>> libsvn
>> subdir, altho I'd be find with building into python/build/).
> 
> 
> Yeah, that whole build and copy thing is still a myth to me in many 
> ways. I just browsed through the pieces that I needed to change to make 
> my patch work.
> 
> Actually, I don't really care where we're building stuff. I really like 
> to view things from the python programmer's perspective which 
> essentially is something like apt-get install python2.2-subversion and 
> from svn import <module> ;)
> 
>>> When this patch is applied, all python code should still run unless 
>>> it uses accessor functions. Instead of using accessor functions, you 
>>> can now simply acquire the attribute of your struct wrapping object 
>>> to acquire a struct member (e.g. ctx.auth_baton instead of 
>>> svn_client_ctx_t_auth_baton_get(ctx).).
>>
>>
>> All the accessor functions are still present in the wrapper, so shouldn't
>> old code continue to work just fine?
> 
> 
> Err, no. The accessor functions are in the libsvn._*.so extension 
> modules, but are not imported to the regular python modules in libsvn. 
> Thus, they aren't imported into svn either.
> 
> Phil
> 


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

Re: [PATCH] SWIG bindings refactoring (esp. python)

Posted by Philipp von Weitershausen <ph...@weitershausen.de>.
Greg Stein wrote:
> +1 on the patch concept and from a simple review. I haven't applied and
> tested, however.
> 
> -0 on the changes to the SWIG invocation for Java. I'm not sure they are
> ready or want the proxies (yet).

Ok. I guess I was a little too ambitious here. Do you want me to send an 
updated version of the patch?

> In a future change, I'd like to see a swig/python/libsvn/ subdir cuz I'm not
> too cozy with the __init__.py addition (but it is fine for now). That would
> alter the copying strategy (and I don't think we want to build in the libsvn
> subdir, altho I'd be find with building into python/build/).

Yeah, that whole build and copy thing is still a myth to me in many 
ways. I just browsed through the pieces that I needed to change to make 
my patch work.

Actually, I don't really care where we're building stuff. I really like 
to view things from the python programmer's perspective which 
essentially is something like apt-get install python2.2-subversion and 
from svn import <module> ;)

>>When this patch is applied, all python code should still run unless it 
>>uses accessor functions. Instead of using accessor functions, you can 
>>now simply acquire the attribute of your struct wrapping object to 
>>acquire a struct member (e.g. ctx.auth_baton instead of 
>>svn_client_ctx_t_auth_baton_get(ctx).).
> 
> All the accessor functions are still present in the wrapper, so shouldn't
> old code continue to work just fine?

Err, no. The accessor functions are in the libsvn._*.so extension 
modules, but are not imported to the regular python modules in libsvn. 
Thus, they aren't imported into svn either.

Phil


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

Re: [PATCH] SWIG bindings refactoring (esp. python)

Posted by Greg Stein <gs...@lyra.org>.
On Tue, May 13, 2003 at 11:36:14PM +0200, Philipp von Weitershausen wrote:
> My goal is to make the SWIG bindings to python as easy to use and as 
> pythonic as possible. The following patch is a result of the previous 
> discussion with cmpilato and Greg Stein ("eliminate -noproxy flat to SWIG").

+1 on the patch concept and from a simple review. I haven't applied and
tested, however.

-0 on the changes to the SWIG invocation for Java. I'm not sure they are
ready or want the proxies (yet).

In a future change, I'd like to see a swig/python/libsvn/ subdir cuz I'm not
too cozy with the __init__.py addition (but it is fine for now). That would
alter the copying strategy (and I don't think we want to build in the libsvn
subdir, altho I'd be find with building into python/build/).

Otherwise, this looks just great.

> When this patch is applied, all python code should still run unless it 
> uses accessor functions. Instead of using accessor functions, you can 
> now simply acquire the attribute of your struct wrapping object to 
> acquire a struct member (e.g. ctx.auth_baton instead of 
> svn_client_ctx_t_auth_baton_get(ctx).).

All the accessor functions are still present in the wrapper, so shouldn't
old code continue to work just fine?

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