In article <[EMAIL PROTECTED]>, Ronald Oussoren <[EMAIL PROTECTED]> wrote:
> > On Wednesday, June 07, 2006, at 11:07AM, Russell E Owen > <[EMAIL PROTECTED]> wrote: > > >At 5:06 PM -0700 2006-06-05, Bob Ippolito wrote: > >>On Jun 5, 2006, at 4:56 PM, Russell E. Owen wrote: > >> > >>>When using py2app to create an application, is there a simple way to get > >>>the path to the copy of python that is/will be bundled into the > >>>application? > >>> > >>>(I need this to copy in some matploblit data files) > >>>So far I'm generating it manually using some assumptions. it works but > >>>if there's a safer/easier way, I'd rather use that. > >> > >>I don't know how matplotlib is structured, but you might want to > >>look at writing a recipe for it. The pygame and PyOpenGL examples > >>show how to include a few data files or an entire package as-is. > > > >That is a great idea. I'll take a look at creating such a recipe. > > > >Meanwhile...is there a simple way to get the path to the python > >framework that is within the bundled application? > > That's not really needed if matplotlib stores its datafiles in the same > directory as its python files (that is in the package directory). In that > case you can just explicitly include matplotlib (using the packages option). > If that works you can create a recipe that does the same automaticly when a > program depends on matplotlib. os.env["MATPLOTLIBDATA"] matplotlib 0.82 (which is somewhat outdated) looks here, in this order: .../Contents/Frameworks/Python.framework/Versions/2.4/share/matplotlib /usr/local/share/matplotlib /usr/share/matplotlib .../Contents/Resources/Python/site-packages/matplotlib/share/matplotlib .../Contents/share/matplotlib Although the last path is very convenient, by then matplotlib has looked in all sorts of places I don't want it to look -- I want it to find the packaged data files rather than any the user might have from possibly a different (and possibly incompatible) version of matplotlib. So I use the first path, which is a pain to construct -- hence my desire to ask py2app for the path. Apparently the current matplotlib is more sensible about where it puts its data files, so this may be moot. >... > What shortcut links? Py2app special-cases the python framework because we > know how it is structured and know what parts must be copied into the > application to get a working bundle. For Tcl/Tk, one may put extension libraries (such as snack) into: .../Contents/Framework/Tcl.Framework/Resources That works because Resources is a link. The full path (without links) is: .../Contents/Framework/Tcl/Framework/Versions/8.4/Resources which would you rather use, especially since the version number may change?!!! Unfortunately one cannot play a similar trick with python. The main installation of python has various useful shortcut links, but py2app doesn't copy them. > The tcl/tk framework is treated specially and that should mean the entire > framework is copied verbatim. That again means that it shouldn't be necessary > to specify that some additional datafiles in that framework should be copied > because they'll be included anyway. Tcl/Tk extensions are not auto-copied by py2app. Perhaps that is because they live in /Library/Tcl, rather than part of the tcl framework itself. On the whole I'm pleased because I have a ton of tcl extensions that I don't use (I use ActiveTcl -- it saves manually trying to install snack, which is a pain to build). But the flip side is that one has to figure out where to put tcl extensions in the bundled app. It's not documented anywhere that I could find, so I used trial and error. Also, the obvious-but-wrong thing to do is specify the extensions using the dataFiles argument with the correct final destination. That fails if one relies on the handy shortcut links because Tcl framework is copied *after* the data files. When the data files are copied, real directories are created instead of the necessary links, and that prevents the tcl framework from being properly copied. I really need to spend some time to document this publicly. But where? _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig