[Pythonmac-SIG] How to make py2app app stub link to Cocoa framework?

Ronald Oussoren ronaldoussoren at mac.com
Thu Nov 10 11:39:04 CET 2011


On 9 Nov, 2011, at 5:41, Kevin Walzer wrote:

> I've been trying to get one of my Python-Tk applications to integrate with Lion's sandboxing framework (for Mac App Store submission) and have been having difficulty. Based on some feedback I received in the Apple Developer forums, it appears that part of the issue is that the executable stub created by py2app does not link to the Cocoa frameworks.

What kind of problem did you run into? Are those something that can be easily reproduced by signing a trivial application?


> A quick run of otool -L confirms this:
> 
> Kevin-Walzers-MacBook:~ kevin$ otool -L /Users/kevin/Programming/quickwho/cbk/QuickWho.app/Contents/MacOS/QuickWho
> /Users/kevin/Programming/quickwho/cbk/QuickWho.app/Contents/MacOS/QuickWho:
> 	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 832.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10)
> 
> Is there any way I can get this executable linked to /System/Library/Frameworks/Cocoa.framework? I didn't think install_name_tool would do the trick, as that just rewrites links, rather than adding them. A
> 
> Any suggestions are appreciated.

You'll have to rebuild the stubs, and as you already noticed you can do this by patching the setup.py in py2app/apptemplate.

BTW. The reason py2app doesn't link with Cocoa is to avoid Cocoa's triggering backward compatibility modes. That is, when you link to Cocoa.framework with the 10.4 SDK a number of classes will behave slightly different than they do when linking to the 10.6 SDK. The precisedetails elude me at the moment though.

It might be useful to add separate stubs for codesigning (possibly with additional flags in py2app to trigger codesigning from your setup.py file), or even replace the current stubs by ones that link to the Cocoa frameworks.

Ronald
> 
> --Kevin
> 
> -- 
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4788 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20111110/aa9e2801/attachment.bin>


More information about the Pythonmac-SIG mailing list