[Pythonmac-SIG] Building an app with dependencies

Alexandre Quessy alexandre at quessy.net
Sat Nov 8 00:37:14 CET 2008


Hi all,
I am trying to build a Python Mac OS X application that has quite a
lot of dependencies. We rely on wx, appscript, objc, zope, twisted and
more. Below I provide my setup.py script. I am trying to use py2app
(version py2app-0.3.6-py2.4.egg) as mentionned on the page
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#uninstalling-py2app-0-2-x-or-earlier
.
When I try to build it I get the following error : "running py2app
"""
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app-0.3.6-py2.4.egg/py2app/build_app.py",
line 548, in _run
    self.run_normal()
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app-0.3.6-py2.4.egg/py2app/build_app.py",
line 600, in run_normal
    mf = self.get_modulefinder()
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app-0.3.6-py2.4.egg/py2app/build_app.py",
line 508, in get_modulefinder
    debug=debug,
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/modulegraph-0.7-py2.4.egg/modulegraph/find_modules.py",
line 243, in find_modules
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/modulegraph-0.7-py2.4.egg/modulegraph/find_modules.py",
line 179, in find_needed_modules
TypeError: unsubscriptable object
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/modulegraph-0.7-py2.4.egg/modulegraph/find_modules.py(179)find_needed_modules()
(Pdb) interrupted"
"""

.... below is my complete setup.py script.
Anyone has an idea on why i get this ? Is one of my arguments of a bad type ?
Also, is there an alternative to listing the whole list of packages
and modules to be included in the app?
I am using Tiger, but I would like this to work also on Leopard, if possible.
Thanks !!
-- 
Alexandre Quessy
http://alexandre.quessy.net/

------------------------


import sys
from distutils.core import setup
import py2app

# ---------------------------------
# path:
for p in ['../lib','../deps/eggs','../deps/suds-0.2.8']:
    sys.path.append(p)
# ---------------------------------
# packages are directories of python modules with an __init__.py file.
ALLPACKAGES= ['wx','suds','appscript','mactypes','twisted','restclient','xml','objc','QTKit','AppKit']
# modules are python files.
ALLMODULES=  ['feedparser','ConfigParser','urlparse','htmllib',
'formatter','HTMLParser','pprint',
'os','time','copy','subprocess','glob','urllib','md5','urllib2','sys','shelve','mactypes']
# we would be better to put those in a package:
MOREMODULES = ['RawItem','RawChannel','RawConfig','RawSerializable','RawFilter','RawItemsManager','RawMobileMuse','RawSiftAggregator','RawStateSaver','RawTextConvert','saveQuicktimeStream','LivecastSupport','RawHypertextImageExtractor','wxSupport','lib_rawmaterials','osc_protocol','RawHypertextStripper','RawYoutubeRipper']
for m in MOREMODULES:
    ALLMODULES.append(m)
print "----------------------------"
print "ALLMODULES:",ALLMODULES
print "ALLPACKAGES:",ALLPACKAGES
print "----------------------------"
# ---------------------------------
# Build the .app file
setup(
    options={
        'py2app':{
            'iconfile':'resources/RawMaterials.icns',
            'packages':ALLPACKAGES,
            'includes':ALLMODULES,
            'site_packages':True,
            'resources':['resources/License.txt'],
            'plist':dict(
                CFBundleName               = "RawMaterials",
                CFBundleShortVersionString = "0.3.0",     # must be in
X.X.X format
                CFBundleGetInfoString      = "RawMaterials 0.3.0",
                CFBundleExecutable         = "RawMaterials",
                CFBundleIdentifier         = "ca.qc.sat.rawmaterials",
            )
        },
    },
    app=[ 'RawMaterials.py' ]
)


More information about the Pythonmac-SIG mailing list