[Stackless] Stackless application distribution with OS X

Ásgeir Bjarni Ingvarsson istari at hlekkir.com
Fri Apr 18 12:52:42 CEST 2008

Just in case I'm not the only OS X user here that this wasn't obvious
to, here is a small bash script I used to build a private framework for
This means that the Python.framework can reside under
MyApplication.app/Contents/Frameworks and will not clobber the end
user's python distribution. Allowing distribution of applications that
use stackless, along with any extra library modules, as a single .app
bundle and not as a package with an installer.
You may need to check if there are extra newlines, created by my e-mail
program, that change the script.

# BEGIN build_stackless_private_framework.sh
svn co $SVNPTH stackless
cd stackless

./configure --enable-stacklessfewerregisters --enable-universalsdk \
make -j 2
make install DESTDIR=`pwd`/staging/

cd staging/Frameworks
tar -czf stackless_private_framework.tar.gz Python.framework
mv stackless_private_framework.tar.gz ../../..

cd ../../..
# END build_stackless_private_framework.sh

Any Cocoa or Carbon application can now be made to use this new
framework. You will need to create a build phase to copy
Python.framework into the application bundle under
I find it convenient to first create a Carbon application that is simply
a wrapper around the Py_Main function and give it a symlink to the
framework so I can build any needed binary modules using setuptools.

// Begin main.c
#include <Python/Python.h>

int main(int argc, char *argv[])
     return Py_Main(argc, argv);
// End main.c

mkdir -p build/Release/StacklessInterpreter.app/Contents/Frameworks
ln -s `pwd`/Python.framework \
cd somemodule
../build/Release/StacklessInterpreter.app/MacOS/StacklessInterpreter \

More information about the Stackless mailing list