[Pythonmac-SIG] py2app: how to force packages into application bundle?

Joe Losco joelosco at frontiernet.net
Tue Sep 16 17:53:56 CEST 2008


On Sep 16, 2008, at 11:15 AM, weddingmusic at partybombe.de wrote:
>
> 1)
> easy_install -U somemodule==dev
> run into
> NameError: global name 'log' is not defined
>
> searching the web i figured out that this is a problem of subversion  
> 1.5 and setuptools.
>
> at least i could fix this by checkout current setuptools-dev manually:
> svn checkout http://svn.python.org/projects/sandbox/trunk/setuptools
> and installing by
> python setup.py install

Hmm.. thats strange.  I wonder why I did not run into the bug.  I have  
setuptools-0.6c8-py2.5.egg installed only.  I do not have  
setuptools-0.7 installed.  I have subversion installed through  
Macports.. ahh.. I have version 1.4.6 of subversion installed.  That  
must be why.

> 2)
> now i could install current development version of py2app,  
> modulegraph and macholib as you suggested.
> my third party dictionary (/Library/Frameworks/Python.framework/ 
> Versions/2.5/lib/python2.5/site-packages ) looks like this now:
>
> ClientForm-0.2.9-py2.5.egg
> altgraph-0.6.7-py2.5.egg
> bdist_mpkg-0.4.3-py2.5.egg
> easy-install.pth
> macholib-1.1-py2.5.egg
> macholib-1.2.1.dev_r23-py2.5.egg
> mechanize-0.1.8-py2.5.egg
> modulegraph-0.7-py2.5.egg
> modulegraph-0.7.2.dev_r21-py2.5.egg
> py2app-0.3.6-py2.5.egg
> py2app-0.4.2-py2.5.egg
> setuptools-0.6c8-py2.5.egg
> setuptools-0.7a1dev_r66388-py2.5.egg
> setuptools.pth
>
> I'm not quite sure whether i should remove the old packages when  
> installing new ones?

It won't hurt taking the old ones out, but most likely you will need  
to check the contents of the easy-install.pth so that it does not  
reference old files that no longer exist.


> 3)
> running python setup.py py2app returns some new error now:
>
> running py2app
> Traceback (most recent call last):
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py",  
> line 579, in _run
>    self.run_normal()
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py",  
> line 631, in run_normal
>    mf = self.get_modulefinder()
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py",  
> line 539, in get_modulefinder
>    debug=debug,
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/ 
> find_modules.py", line 255, in find_modules
>    find_needed_modules(mf, scripts, includes, packages)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/ 
> find_modules.py", line 176, in find_needed_modules
>    mf.run_script(path)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 369, in run_script
>    self.scan_code(co, m)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 638, in scan_code
>    self.scan_code(c, m)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 610, in scan_code
>    self._safe_import_hook(name, m, fromlist)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 540, in _safe_import_hook
>    mods = self.import_hook(name, caller)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 380, in import_hook
>    q, tail = self.find_head_package(parent, name)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 419, in find_head_package
>    q = self.import_module(head, qname, parent)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 493, in import_module
>    parent and parent.packagepath, parent)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 680, in find_module
>    fp, buf, stuff = find_module(name, path)
>  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py",  
> line 114, in find_module
>    if isinstance(importer, pkg_resources.ImpWrapper):
> AttributeError: 'module' object has no attribute 'ImpWrapper'
>> /Users/me/python_test/build/bdist.macosx-10.3-i386/egg/modulegraph/ 
>> modulegraph.py(114)find_module()
> (Pdb)
>
> Anyone has got ideas?
> thank you
> axel
>

well.. I checked your versions of macholib, modulegraph, and py2app  
and I have the same.. the only item I do not have is the newer version  
of setuptools.  Unfortunately I'm stumped now without looking into it  
farther.
The only other difference I see is my setup.py from my old program has

from distutils.core import setup not from setuptools import setup

other than that I'm not sure why its not working as your program is  
not complicated in any means.

Best of luck and if you find out any other information, let me know.
Joe



More information about the Pythonmac-SIG mailing list