From: Alex T. <al...@tw...> - 2006-05-09 01:24:36
|
[ if you didn't see it, I posted a message on pythoncard-users with some of the background ] Problem is in finding resource files for modules in sub-directories of the application, and is specific to Mac and to Python2.4 In model.py, we do > def childWindow(parent, frameClass, filename=None, rsrc=None): > if filename is None: > if rsrc is None: > if util.main_is_frozen(): > # KEA 2004-05-20 > # running standalone > # need to support py2exe differently than > bundlebuilder and mcmillan probably > # but this is the py2exe 0.5 way > # figure out the .rsrc.py filename based on the module > name stored in library.zip > filename = > os.path.split(sys.modules[frameClass.__module__].__file__)[1] > # KEA 2004-09-14 > # it seems sort of dumb to duplicate this function > # just to handle the parent differently > # so I'm adding this check > if isinstance(parent, wx.Notebook): > parentFrame = parent.GetParent().GetParent() > filename = > os.path.join(parentFrame.application.applicationDirectory, filename) > else: > filename = > os.path.join(parent.application.applicationDirectory, filename) > else: > # figure out the .rsrc.py filename based on the module > name > filename = sys.modules[frameClass.__module__].__file__ > # chop the .pyc or .pyo from the end > base, ext = os.path.splitext(filename) > filename = internationalResourceName(base) > rsrc = resource.ResourceFile(filename).getResource() in util.py, we do > # Thomas Heller's function for determining > # if a module is running standalone > def main_is_frozen(): > if sys.platform == 'darwin': > # this is a temporary hack for bundlebuilder > return not sys.executable == > '/System/Library/Frameworks/Python.framework/Versions/2.3/Resources/Python.app/Contents/MacOS/Python' > else: > return (hasattr(sys, "frozen") or # new py2exe, McMillan > hasattr(sys, "importers") # old py2exe > or imp.is_frozen("__main__")) # tools/freeze, cx_freeze Clearly, the fact that we have that specific test using a Python 2.3 path is a problem. I have temporarily got around this (for my own Mac system) by changing that line to return not (sys.executable == '/System/Library/Frameworks/Python.framework/Versions/2.3/Resources/Python.app/Contents/MacOS/Python' or '/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python') Note I assumed that 2.4 would (sensibly) not be installed in the System Library, but even so this won't work for 2.5, and could fail for other installation possibilities. If anyone who understands this better knows how this *should* be solved, please speak up. :-) Otherwise, I'll commit this band-aid for now - I think it (or better) should be in 0.8.2, because I think there is more interest in Python 2.4 for Mac (py2app requires 2.4 or greater, the Universal build is out for 2.4, etc.) Since I have this change to do, I'll also fix a typo in the docs directory before re-doing the builds intended to be the release of 0.8.2. Phil - let me know whether you think we will be able get the better standaloneBuilder in soon, or whether we should simply hold standaloneBuilder out of this release. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 05/05/2006 |