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

Kevin Walzer kw at codebykevin.com
Thu Nov 10 14:59:48 CET 2011


On 11/10/11 5:39 AM, Ronald Oussoren wrote:

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

It wouldn't display a save dialog. Under the hood Tkinter/Tk's save 
dialog calls into NSSavePanel. In a sandboxed app, the call to 
NSSavePanel is supposed to be intercepted by the Powerbox (sandbox save 
dialog), but no dialog would display.
>
> 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.

Rebuilding the stubs was easy enough to do, and sufficient for my needs, 
but if you decide to add this capability to py2app, I'm sure other folks 
would find it useful.

--Kevin


-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com


More information about the Pythonmac-SIG mailing list