[Pythonmac-SIG] Re-linking app with system Tk frameworks

Ronald Oussoren ronaldoussoren at mac.com
Mon Jan 28 15:31:43 CET 2013


On 28 Jan, 2013, at 14:26, Kevin Walzer <kw at codebykevin.com> wrote:

> Hi,
> 
> To deploy my Tkinter app to the Mac App Store, it has to be linked against the system Tcl/Tk frameworks because Tk uses internal/private API calls. (You can't submit an app that makes such calls directly, but apparently system-installed libraries are exempt.) My last build of Python linked against /System/Library/Tcl.framework and friends, but a more recent build I'm using links against /Library/Frameworks/Tcl.framework et al.
> 
> Is there an install_name_tool trick I can run with py2app to make sure my deployed Tkinter app links against the system framework rather than my own installation in /Library/Frameworks? I don't want to have to rebuild Python to achieve this effect, but my previous experience with py2app suggests that it's the only way to make sure py2app doesn't vaccum up the /Library/Framework bits.

This should work:

$ install_name_tool -change /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl \
         -change /Library/Frameworks/Tk.framework/Versions/8.5/Tk /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk     _tkinter.so

Check that the binary is actually changed with 'otool -vL _tkinter.so'

I haven't checked that the output actually works.

It should be possible to exclude the Tk and Tcl frameworks from the py2app bundle using the '--dylib-excludes' option. That option is not yet tested by the py2app testsuite, and I'm therefore not 100% sure that it actually works. If it does work you can call install_name_tool on the _tkinter.so binary copied into the app bundle.

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



More information about the Pythonmac-SIG mailing list