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

Re: Fixing ctypes-python bindings APIs - back-compat? [was: svn commit: r1156826 - in /subversion/trunk/subversion/bindings/ctypes-python: csvn/repos.py test/remoterepos.py]

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Fri, 12 Aug 2011 09:44:36 +0100

I (Julian Foad) wrote:
> I committed this API change (below) in the ctypes-python bindings.
> Should I be revving these APIs in some way, to maintain backward
> compatibility, or is this kind of fix considered fair game?

A bit of context. I'm trying to use the Python bindings in order to
write tests for the libsvn_client diff API, the 'diff summarize' in
particular. I need to bypass the 'svn' command-line client and test the
raw results (callbacks), not the screen output that 'svn' produces. And
I want to make use of the existing test support functions for setting up
a working copy, checking tree results, etc.

Greg said just now in another thread
<http://svn.haxx.se/dev/archive-2011-08/0205.shtml>:
> There is some experimental work using ctypesgen-based bindings. I did
> a small amount of work on them a couple years ago, but it could use
> more work. [...]

Does anyone have a feeling for whether it would make more sense for me
to use the swig-py bindings instead for this task at this time?

- Julian

> Julian Foad wrote:
> > In the ctypes-python bindings: fix two RemoteRepository methods to return
> > the Python types they claim to return, and add tests for these and other
> > methods that had no tests.
> >
> > This is an API change in the ctypes-python bindings.
> >
> > * subversion/bindings/ctypes-python/csvn/repos.py
> > (RemoteRepository.list): Create and return a Python dictionary of
> > svn_dirent_t objects instead of the Hash of pointer objects.
> > (RemoteRepository.info): Dereference the pointer object and so return a
> > svn_dirent_t object.
[...]
> > @@ -154,7 +154,12 @@ class RemoteRepository(object):
> > svn_ra_get_dir2(self, dirents.byref(), NULL, NULL, path,
> > rev, fields, dirents.pool)
> > self.iterpool.clear()
> > - return dirents
> > + # Create a Python dict of svn_dirent_t objects from this Hash of
> > + # pointers to svn_dirent_t.
> > + result = {}
> > + for path, dirent_p in dirents.items():
> > + result[path] = dirent_p[0]
> > + return result
[...]
> > @@ -178,7 +183,7 @@ class RemoteRepository(object):
> > rev = self.latest_revnum()
> > svn_ra_stat(self, path, rev, byref(dirent), dirent.pool)
> > self.iterpool.clear()
> > - return dirent
> > + return dirent[0]
Received on 2011-08-12 10:45:19 CEST

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.