[PyKDE] distutils for SIP extensions (=Help needed with SIP)

gvermeul at labs.polycnrs-gre.fr gvermeul at labs.polycnrs-gre.fr
Thu Aug 23 01:08:30 BST 2001


Hello Jon,

Pretty sure that everything went OK with distutils.
You just slipped in the last step.

Your going back from 2.5 to 2.4 is because of a code generation bug
in sip-2.5. This is been fixed automatically by my scripts.

> 
> Did the patch according to your instructions without any problems.
> 

Patch is not really necessary for PyMMM-0.0.2, but does no harm.

> Now get this:
> 
> [john at localhost PyMMM-0.0.2]$ python setup.py build_ext
> running build_ext
> generating MMM/MMM.py from sip/MMM.sip, sip/CCC.sip
> /usr/bin/sip -I sip -I /usr/share/sip/qt -c MMM -t Qt_2_3_0 sip/MMM.sip
> ....fixing by means of fixmmm.fix(dir, name)
> ....fixing the sip include bugs

Here, the sip's code generation bug gets fixed (by tools/fixmmm.py
in PyMMM-O.O.2.

[...] 

> g++ -shared build/temp.linux-i686-2.1/CCC.o build/temp.linux-i686-2.1/moc_CCC.o
build/temp.linux-i686-2.1/MMMcmodule.o build/temp.linux-i686-2.1/sipMMMCCC.o
-L/usr/lib/qt2/lib -Lbuild/lib.linux-i686-2.1 -L/usr/lib/python2.1/site-packages -lsip
-lqt -lqtcmodule -o build/lib.linux-i686-2.1/libMMMcmodule.so
> copying MMM/MMM.py -> build/lib.linux-i686-2.1
> byte-compiling build/lib.linux-i686-2.1/MMM.py to MMM.pyc

OK
[...]

> [john at localhost PyMMM-0.0.2]$ python examples/xmmm.py
> Traceback (most recent call last):
>   File "examples/xmmm.py", line 17, in ?
>     from MMM import *
> ImportError: No module named MMM
> [john at localhost PyMMM-0.0.2]$

You did not follow the instructions (same happens to me when I repeat your
commands). You should have done:

cd examples
python xmmm.py

Reason is that xmmm.py tries to locate MMM.py by trying to find
./build/lib.*/libMMMcmodule*
to adapt sys.path (assuming MMM.py is in the same directory).

This does not work from PyMMM-0.0.2, but does from PyMMM-0.0.2/examples.


The problem is related to the sip-2.5 code generation bug. I understand
that for you it is a show stopper. I think I can fix it rather easily
by creating a python script fixyourstuff.py (along the line of
PyMMM-0.0.2/tools/fixmmm.py (or fixqwt.py <- but that does more)
and adapting your Makefile template as indicated below.

> My autoconf project (which builds and works with PyQt2.4 and sip2.4) gives the following
errors on PyQt2.5 and sip2.5. Thats why I went back to 2.4 ???
> 
> <<<<<<    make   >>>>>>
> cd . && autoheader
> make  all-recursive
> make[1]: Entering directory `/home/john/projectspy/filecopy'
> Making all in sip
> make[2]: Entering directory `/home/john/projectspy/filecopy/sip'
> sip -I ../sip -I /usr/share/sip/qt -c . ../sip/MMM.sip

Insert here in your Makefile template (for 2.5):
        python ../tools/fixyourstuff.py
 
> touch rebuild-src
> c++ -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.1 -I/usr/include/sip

[...]
> c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/python2.1 -I/usr/include/sip
-I/usr/lib/qt2/include -I/usr/X11R6/include -fn
> o-rtti -fno-exceptions -O2 -Wp,-MD,.deps/MMMcmodule.pp -c MMMcmodule.cpp  -fPIC -DPIC -o
MMMcmodule.lo
> In file included from sipqtQMenuBar.h:21,
>                  from sipqtQMainWindow.h:11,
>                  from sipqtQToolBar.h:10,
>                  from sipqtQToolButton.h:12,
>                  from sipqtQStyle.h:19,
>                  from sipqtQWidget.h:22,
>                  from sipqtQPixmap.h:15,
>                  from sipqtQVariant.h:13,
>                  from sipqtQObject.h:12,
>                  from sipMMMJJEncryption.h:9,
>                  from MMMcmodule.cpp:7:
> sipqtQPopupMenu.h:78: `QTabletEvent' was not declared in this scope

So adapting fixmmm.py, the todo list in 'fix()' should start with

todo = [('sipqtQPopupMenu.h', 'header-file-for-QTableEvent',
         'first-header-file-in-list')]

This smells real dirty hacking (for PyQwt, I had to do it in two
places). Also your problem looks different compared to mine.

Maybe there is a real solution to this problem.

Maybe it is better to give up on 2.5 and stick with 2.4 (at least
that is my advice, until you gain more experience or really need
one of the new features in PyQt/sip-2.5).

I am afraight that for PyQwt I will have to support sip-2.4 and 2.5 ;-(
and for PyMMM/distutils also.

In any case thanks for your help - I learned something

Gerard


---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/






More information about the PyQt mailing list