Monday, May 21, 2007

Update 1: All Is Not Well In Mac Land

First of all, a few words on this blog: the idea here is to provide ~weekly (more often as needed) updates on my progress with updating the python bindings for the subversion API. My original proposal can be found on the SoC site, but beware that some details have changed since then, as per discussion on th mailing list.

At present the code base is just as my mentor, David James, left it. I have been planning how the final binding should look and work, which has been more challenging then I thought. I've never planned something quite so broad as this before, most of my design work has been much narrower in scope. I looked at existing bindings, as well as some of the Perl packages on CPAN, to get some ideas of how the final bindings should work. My design philosophy at present is to abstract away as much as possible, giving the API programmer an interface similar to what they would have through command line tools.

In the process of studying David's existing ctypes work, I found that at present the autogen system will not work on Mac. I had been working remotely on a linux box, where the system worked well enough, but some issues made me move development to my MacBook, on which the system to autogenerate ctypes bindings does not work. I've encountered one error I've identified and one that has me stumped.

First the one I've figured out: the yacc.py stuff used to parse C files as part of building the bindings does not like a few features that are used in some of the standard Mac libraries (byte order stuff mostly), including keywords like 'inline' and a few other things (bool values, some preprocessor directives, etc.). My present workaround is to create temporary duplicates that avoid the features that don't parse as best I can.

Even with all these files parsing correctly, I still have issues with some functions apparently not making it into the ctypes binding. Haven't figured this out yet, but I'm working on it.

I was hoping to have a complete design document today, but I feel that what I have is a little incomplete. I'm going to be in contact with my mentor this week to try to complete this design. I'm also planning on implementing a few incremental upgrades that James suggested for me. These are(quote from email):

- Rename ClientSession to RemoteRepository
- Rename LocalClient to LocalRepository
- Rename ClientURI to RepositoryURI
- Move helper classes in client.py into a different file, not sure
of the name yet
- Rename client.py to repository.py, so as to make clear that it's
intended for direct repository access
- Replace '@staticmethod' attributes from csvn/core/__init__.py
with Python 2.3-compatible syntax
- Write some documentation on how to run the mucc-test.py test suite.

Most of these changes are fairly straightforward (I've actually already done a few, but I can't really call them complete since I can't run the tests to make sure they work, see above about the problems I'm having). I think they'll give me a good chance to get some hands on hacking experience, since as of yet I've mostly just messed around with added print statements so I can track the control flow.