Update: This tutorial was expanded again and posted
This is a cheap entry since I just added this answer to the
MacPython FAQ on
how to build a stand-alone MacOS X application using Python.
This can be very easy to build using bundlebuilder.py.
First create your app building script like so:
from bundlebuilder import buildapp
name='Application.app', # what to build
mainprogram='main.py', # your app's main()
argv_emulation=1, # drag&dropped filenames show up in sys.argv
iconfile='myapp.icns', # file containing your app's icons
standalone=1, # make this app self contained.
includeModules=, # list of additional Modules to force in
includePackages=, # list of additional Packages to force in
Besides building a stand-alone application which will bundle up everything
you need to run your application including the Python.Framework, you can
build using 'semi-standalone=1' instead. This will make your application
bundle smaller as it won't include python, but it does require that your
users already have a working python framework installed. On MacOS X 10.3,
Apple has included a full 2.3 Python.Framework for you which will work
with semi-standalone applications just fine.
There are other options you can set in the call to buildapp(). See the
bundlebuilder.py module for the rest of them.
Then do this:
% python makeapplication.py build
That command should create a build/Application.app bundle, which may
even work, but probably needs a little help. There will most likely be
a few warnings. These can usually be ignored safely. Also, there may
be additional modules and libraries which need to be included that
buildapp() couldn't determine. You can add those it missed using the
includeModules and includePacakges arguments to buildapp().
For example, if your application used Tkinter, you may need to copy
Tcl.Framework and Tk.Framework into
build/Application.app/Contents/Frameworks. You can use those from the
package (i.e. the Wish.app/Contents/Frameworks/*).