[PyKDE] PyQt / sipdistutils
Jasper R. Plaisier
plaisier at chem.leidenuniv.nl
Wed Nov 30 14:55:11 GMT 2005
Hello all,
I am trying to package an extension module that works with qt objects. I
therefore wrapped the code using sip and everything seems to work fine
when i build in the documented using a .sip file and configuration.py.
Now I am trying to package everything for distribution using
sipdistutils. This worked fine for non-qt containing code. In this case,
however, the .sip file contains the line %Import qt/qtmod.sip, and the
build process stops with the error that this file cannot be found. This
makes sense since sip runs without the -I flag.
I have now worked around the problem in a quick and dirty way by copying
sipdistutils.py to pyqtdistutils.py and changing the code in
_sip_compile to the following
def _sip_compile(self, sip_bin, source, sbf) :
import pyqtconfig
pqconfig = pyqtconfig.Configuration()
os.system(" ".join([sip_bin,
"-c", self.build_temp,
"-b", sbf,
"-I", pqconfig.pyqt_sip_dir,
pqconfig.pyqt_qt_sip_flags,
source]))
This works fine. HOwever, I had te change the self.spawn call to
os.system, because the first would stop on the error:
sip: /usr/share/sip/qt/versions.sip:30: Exactly one of this %Timeline
must be specified with the -t flag
The -t flag is present (and shown on the screen).
I wonder if anyone knows a more generic solution for the problem of not
being able to compile the extension module with qt, and if anyone
understands the problem with self.spawn.
For completeness I also include my setup.py script
from distutils.core iport setup, Extension
import pyqtdistutils
setup(
name = 'Cyclops',
version = '0.1',
scripts = ["scripts/Cyclops"],
packages = ["Cyclopswidgets", "Cyclopsdata"],
ext_modules = [
Extension("Cyclopsdata.pylib", ["Cyclopsdata/datwrap.sip",
"Cyclopsdata/fileio.cpp", "CyclopsModel.cpp"],
include_dirs=["Cyclopsdata", "/usr/local/lib", "/usr/lib/qt3/include",
/usr/share/sip"], library_dirs=["/usr/local/lib", "/usr/lib/qt3/lib"],
libraries=["qt", "tiff"])
],
cmdclass = {'build_ext': pyqtdistutils.build._ext }
)
Thnx all, Jasper
--
Jasper R. Plaisier
Biophysical Structural Chemistry Department
Leiden Institute of Chemistry
Leiden University
P.O. Box 9502, 2300 RA Leiden
The Netherlands
More information about the PyQt
mailing list