-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bob Ippolito wrote: > > On Jul 13, 2006, at 1:44 PM, Kevin Walzer wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Bob Ippolito wrote: >>> >>> On Jul 6, 2006, at 4:06 PM, Kevin Walzer wrote: >>> >>>> I have been unable to build the "hello-tk" demo that ships with py2app >>>> if I am building against a "universal" build of Tcl/Tk. >>>> >>>> Here is my setup: >>>> >>>> from distutils.core import setup >>>> import py2app >>>> >>>> setup( >>>> app=['hello.py'], >>>> options=dict( >>>> py2app=dict( >>>> archs="ppc,i386", >>>> >>>> frameworks=["/Library/Frameworks/Tcl.framework","/Library/Frameworks/Tk.framework"] >>>> >>>> >>>> ) >>>> ) >>>> ) >>> >>> I gave up on that broken universal support in 0.2.x and cleaned up what >>> I had in the trunk (0.3). The way it hooks into distutils now (via >>> setuptools) is totally different so it needs a change to your setup >>> files. >>> >>> 1. remove your existing installation of py2app:: >>> >>> rm -rf >>> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/py2app >>> rm >>> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/py2app.pth >>> >>> >>> 2. install setuptools >>> <http://bob.pythonmac.org/archives/2006/01/17/single-line-setuptools-install/> >>> >>> >>> 3. sudo easy_install py2app >>> 4. Change the setup.py:: >>> >>> # used to be "from distutils.core import setup" >>> from setuptools import setup >>> setup( >>> app=['hello.py'], >>> # this is actually useless... >>> options=dict(py2app=dict(frameworks=['Tcl', 'Tk'])), >>> # this is new >>> setup_requires=['py2app'], >>> ) >>> >>> Explicitly specifying the Tcl and Tk frameworks is pointless because the >>> Tkinter extension either links to them or it doesn't. If it does link to >>> them, py2app will find them and include them. If it doesn't link to them >>> (or it links to the /System version, for example) then it still won't >>> use them even if they are present in the app bundle. >>> >>> FYI, the repositories for py2app, macholib, bdist_mpkg, altgraph have >>> all moved to svn.pythonmac.org, e.g.: >>> http://svn.pythonmac.org/py2app/py2app/trunk/ >>> >>> I didn't bother trying to preserve the history, so don't bother trying >>> to svn switch. >>> >>> -bob >>> >> >> This new approach seems to work well. I've tested it not just with the >> basic demo but with a different script that incorporates a Tk-specific >> extension with a Python wrapper (Tile). Thank you. >> >> My only reason for wanting to use a universal build of Tcl/Tk is to >> avoid things breaking if the application runs on a later version of OS X >> with a later version of Tcl/Tk installed in /System. Can the tkinter >> module accommodate a later 8.4.x build of Tcl/Tk without breaking? > > It probably can, but you'd have to jigger its install_name in order to > make that happen. > > In your project you could probably do this: > > cp `python -c 'print __import__("_tkinter").__file__'` . > install_name_tool \ > -change /System/Library/Frameworks/Tcl.framework/Versions/8.4/Tcl \ > /Library/Frameworks/Tcl.framework/Versions/8.4/Tcl \ > -change /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk \ > /Library/Frameworks/Tk.framework/Versions/8.4/Tk \ > _tkinter.so > > That will make a copy of _tkinter.so and rewrite its load commands such > that it points at your version of Tcl/Tk instead of the system's. Since > it will be a sibling of your main script, it will be on sys.path before > the standard library and py2app should pick it up instead of the stdlib > version of _tkinter. macholib will see the Tcl and Tk frameworks and > should do the right thing. > > -bob
That works. Thanks. - -- Kevin Walzer Poetic Code http://www.kevin-walzer.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEtsW+rTC5hIgjqTMRAvg8AJ4jfD+UGJY3OnXLe4Iax0wMqvXeZACgkrPI JlsyplIxmYhYywuInIYydBc= =hZO4 -----END PGP SIGNATURE----- _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig