[PyKDE] Any tools to generate sip files?

Jim Bublitz jbublitz at nwinternet.com
Fri Mar 14 00:50:00 GMT 2003


On 13-Mar-03 Hubbard, Dwight wrote:
> I've been looking at trying to generate python bindings for the
> libmyth
> library which is part of the mythtv pvr project (
> http://www.mythtv.org)
  
> I was wondering if there where any tools to automate the
> generation of the .sip files from the .h files instead of doing
> it manually?

Almost.

I have a tool in development that does automatic h->sip conversion,
as well has generating the build scripts and writing some of the
docs. I'm using it to generate the next PyKDE version and it's
essentially complete enough to do that (ignoring the occasional bug
that still pops up now and then). I haven't tried it on anything
except PyKDE, so I'm sure there'll be problems with it, particularly
in generating the build stuff.

I took a quick look at the libmyth sources and only see one problem
- one of the h files has a "using" statement, which is one of the
few things I'm not planning on supporting. You'd have to add
explicit scoping manually to the variables covered by that
statement. I didn't see any place where you'd need to hand write
any C++ code for sip, but I only took a quick look. I also didn't
check to see what beyond the libmyth h files you'd need sip files
for. If libmyth references objects in other libs, you'd need to
bind those too or else hide the references somehow (Qt isn't a
problem however).

The other nice feature of this tool and sip is that they handle
versioning - you can build a new set of sip files from the previous
version's sip files and the new h files. It looks like this project
will be changing fairly rapidly at the moment.

If you have a strong urge to be a guinea pig for undocumented and
probably somewhat buggy incomplete software, I can send you a
tarball (it's all in Python). Basically all you should need to do is
create a project file (assuming it works). You'd also need Python
2.2.2, sip 3.5 and PyQt 3.5 (since libmyth is Qt based). This is
far from releaseable, but works pretty well. If it works, you'd
have sip files in about 20 seconds (all of PyKDE takes about 3 1/2
minutes). There's a strong chance this will be completely useless
to you.

Otherwise, I can take a look at it myself when I get some time.

Jim




More information about the PyQt mailing list