[Pythonmac-SIG] sanity checks: building MacOS X app

John Speno macpython@lopan.dccs.upenn.edu
Fri, 14 Mar 2003 13:41:17 -0500


On Tue, Mar 04, 2003 at 04:50:56PM -0500, John Speno wrote:
> > > Jack Jansen wrote:
> > > > Yes, you should be able to get this to work, but you will have to
> > > > build the Python.framework yourself. I've been looking at creating
> > > > the framework in such a way that it would allow just copying 
> > > > /Library/Frameworks/Python.framework

> I think it is working already. See below.

As everyone knows now, that does work. Using a combination of
modulefinder.py and trial and/or error, I trimmed my app's internal
Python 2.3 framework down to 6MB. With Tcl/Tk, it weighs in at about 14MB.
I could trim that down a bit further by cleaning out the Tcl and Tk
frameworks even.

Then I had an idea. I wondered if I could just use Apple's included python.
Since I needed Tkinter, I pulled down Python 2.2.2 and hacked its setup.py
to use python 2.3's detect_tkinter_darwin() so that it could find and
link to AquaTk 8.4.2. After a make, I took only the resulting _tkinter.so
and put it in my application's Resources directory. I already had a copy of
Tkinter.py with bug fixes in there.

The good news is that this works. The app can be launched from the Finder
or with the 'open' command and all the gui features work. If you run it
from the command line not using 'open', the GUI comes up but doesn't come
to the front or respond to clicks and such. The error is 'SetFrontProcess
failed,-606' though I don't really care about that error since the "normal"
ways of starting the app work fine.

That said, this experiment was interesting, but I think I'll be
distributing the application with its own copy of Python 2.3 anyway,
just to be complete.