[Pythonmac-SIG] relocatable Python framework?

Ronald Oussoren ronaldoussoren at mac.com
Wed Sep 19 07:11:55 CEST 2007


On 19 Sep, 2007, at 6:31, Boyd Waters wrote:

> Hello all!
>
> I maintain a scientific data-analysis application that my team has
> ported to the Macintosh. It's a bunch of C++ strung together with
> Python, and so far that's worked really well.
>
> I want to package this collection of C++ and Python into a Macintosh
> application. And I want the Python framework to go inside the
> application. We'd start via a shell script that calls the Python
> inside our application package.
>
> I've got all the other frameworks and libs set up as relocatable
> objects. But Python is not playing along.
>
> Maybe the user will drag our app bundle to /Applications, but maybe
> not. I can't know where everything is until run-time.
>
> How to I ship the Python framework as a relocatable package inside
> our application?

You'll have to rewrite the loader commands of at least the command- 
line interpreter. I guess the easiest way to do that is to use a .app  
bundle and macho_standalone (part of macholib): Create a (dummy) .app  
bundle by hand and use sys.executable (not the python command) as the  
executable of that application bundle. Then use macho_standalone to  
copy all libraries and frameworks used by the application into the  
application bundle, this will rewrite the loader command's as well.

It might be possible to use py2app to do all the work, that depends on  
how you application is set up.

Ronald
>
>
> Thanks!
>
>
>  - boyd
>
> Boyd Waters
> programmer
> national radio astronomy observatory
> http://www.aoc.nrao.edu/~bwaters
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list