[Pythonmac-SIG] py2app/PyQt/64-bit/Mach-O

Marc-Antoine Parent maparent at acm.org
Sun Dec 27 20:25:42 CET 2009


I also ran into this recently.
I was trying to wrap a PyQt application on Snow Leopard, and I wanted a 64-bit application as a result.

The first issue you ran into involves macholib, and is easy enough to correct; here is the patch file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macholib.diff
Type: application/octet-stream
Size: 11678 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091227/3c72498a/attachment.obj>
-------------- next part --------------


Also, py2app builds a 32-bit bootstrap executable in dist/ApplicationName.app/Contents/MacOS/ApplicationName ; so it will still start in 32 bits. To correct that, the py2app templates have to be rebuilt. Code patch below, and then do the following:

cd {sowewhere}/py2app/py2app/apptemplate
rm prebuilt/main
python setup.py build
cd ../bundletemplate
rm prebuilt/main
python setup.py build

Note that the patch involves bumping the minimum system version from 10.3 to 10.4; Ideally this should be parametrized. Another issue that requires more thought, that Kevin also identified, is the argvemulation not working in 64 bits. My patch just hides the failure at this point, something better has to be done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py2app.diff
Type: application/octet-stream
Size: 3431 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091227/3c72498a/attachment-0001.obj>
-------------- next part --------------


Another issue, finally:
If you're wrapping Qt4, the sip recipe omits the Qt plugins. I adjust it by hand, with the following operations (in bash):

cat > dist/ApplicationName.app/Contents/Resources/qt.conf <<EOF
[Paths]
qt_plugpath=plugins
EOF

cp -r /Developer/Applications/Qt/plugins dist/ApplicationName.app/Contents
strip dist/ApplicationName.app/Contents/plugins/*/*.dylib
for lib in phonon QtCore QtDBus QtGui QtNetwork QtSvg QtWebKit QtXml QtXmlPatterns;
do
  find dist/ApplicationName.app/Contents/plugins -type f -exec install_name_tool -change $lib.framework/Versions/4/$lib @executable_path/../Frameworks/$lib.framework/Versions/4/$lib  {} ';';
done

Again, some work should be done on the recipe, but this should allow people to progress.
Cheers,

Marc-Antoine Parent



More information about the Pythonmac-SIG mailing list