[PyKDE] Building new Qt4 extension with sipdistutils
Dave Fancella
dave at davefancella.com
Fri Oct 6 08:05:12 BST 2006
Hello,
I'm having a leetle problem here. :/ I'll try to be as coherent as I can.
Sorry for the long post.
I need some of the methods that were excluded in PyQt4 in some of the classes,
and some of the classes excluded. In particular, I need the x11 stuff,
QX11EmbedContainer, x11eventfilter(), etc. So I put together a .sip file
based on qx11embed_x11.h that looks right to me, but I'm a sip noob. I want
to use distutils for the whole project, so naturally I went at using the
sipdistutils module to build it.
Fundamentally, what it comes down to is that this command line causes sip to
segfault:
//usr/bin/sip -c build/temp.linux-i686-2.4 -b
build/temp.linux-i686-2.4/qx11embedcontainer.sbf -I //usr/share/sip -x
VendorID -t WS_X11 -x PyQt_Accessibility -t Qt_4_1_2
dsdesktop/dscore/qx11embedcontainer.sip
I found a few bugs in sipdistutils. At least, they really look like bugs.
One, anyway. Googling turned up this thread:
http://www.mail-archive.com/pykde@mats.imk.fraunhofer.de/msg06176.html
So I followed the instructions given by a responder and built a derived class
from sipdistutils.build_ext and copy and pasted some code in there. The bug
I found is in sipdistutils, line 70, which looks like this:
sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, "sbf"))
results in output of the form "Can't fine file thefilebasenamesbf". SO I
replaced it with this (in my derived class):
sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, ".sbf"))
It still can't find the file, but at least it's failing because of the
aforementioned segfault by sip rather than a misnamed file.
Now here's the sticky bit. When I copied and pasted the code from the mailing
list thread, I blissfully failed to notice that I was importing PyQt3 stuff,
namely the pyqtconfig module. When it tried to build with *that* stuff, sip
didn't segfault. Instead it built the .sbf file and passed it along to
distutils which failed to build it due to bad include search path, a problem
easily remedied and a potential solution I haven't pursued yet (in a few
minutes). But I don't expect it to actually *work* because it's using PyQt3
configuration that may not even be true for PyQt4. When I fixed my class to
use the PyQt4 stuff, sip segfaults.
In case anybody wants to look at the code itself, it is available in some
state or other in my personal svn repository (available to the public):
https://svn.davefancella.com/dsdesktop
The files in question are:
setup.py
dsdesktop/dscore/qx11embedcontainer.sip
My problem can be solved by PyQt4 just including the missing stuff, and under
the circumstances I'll be happy to go to svn/cvs head of PyQt4 for a
solution, i.e. there's no requirement that I stick with a stable release, I
just need something that'll be a stable release within the next year, so this
entire email can be disregarded if you guys can tell me PyQt4 will have
QX11Embed* classes and also the x11 methods in QApplication and QWidget
available to me. :) If you actually look at the code, you'll see a very
primitive desktop environment. The project is to build a python-based
desktop environment with which I intend to pursue some alternate UI concepts
I've got, and KDE 3.5 just doesn't stretch far enough. KDE4 probably will,
but this is fun! :) So naturally I need something like kicker that can
receive certain x11 events when new windows are created so I can construct a
taskbar of sorts. And I want to wuss out on writing a terminal program and
just embed xterm.
I'm not even sure what question to ask, so there it is. My problem. What am
I just not understanding that's causing this to happen? I'm pretty new with
building actual extensions with distutils, and this is my first run-in with
sip, so there's plenty of room for me to just not know what I'm doing.
Dave
More information about the PyQt
mailing list