[Pythonmac-SIG] shrink app bundle size (removing unused stuff)?

Carlos Grohmann carlos.grohmann at gmail.com
Wed Mar 14 01:17:38 CET 2012


Hi Ronald,

I downloaded your new version from bitbucket and installed it with

sudo python setup.py install

but when I run py2app I got this:



GuanoMac:build_Mac guano$ python setup.py py2app
running py2app
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build/bdist.macosx-10.6-intel
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build/bdist.macosx-10.6-intel/python2.7-standalone
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build/bdist.macosx-10.6-intel/python2.7-standalone/app
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build/bdist.macosx-10.6-intel/python2.7-standalone/app/collect
creating
/Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/build/bdist.macosx-10.6-intel/python2.7-standalone/app/temp
creating /Users/guano/Documents/Arbeit/OpenStereo/development/build_Mac/dist
creating build/bdist.macosx-10.6-intel/python2.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.6-intel/python2.7-standalone/app/Frameworks
*** using recipe: virtualenv ***
*** using recipe: sip ***
*** using recipe: matplotlib ***
*** using recipe: numpy ***
*** using recipe: wx ***
Traceback (most recent call last):
  File "setup.py", line 75, in <module>
    setup_requires=['py2app'],
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py",
line 152, in setup
    dist.run_commands()
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 953, in run_commands
    self.run_command(cmd)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 972, in run_command
    cmd_obj.run()
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app-0.6.5-py2.7.egg/py2app/build_app.py",
line 480, in run
    self._run()
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app-0.6.5-py2.7.egg/py2app/build_app.py",
line 643, in _run
    self.run_normal()
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app-0.6.5-py2.7.egg/py2app/build_app.py",
line 716, in run_normal
    self.process_recipes(mf, filters, flatpackages, loader_files)
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app-0.6.5-py2.7.egg/py2app/build_app.py",
line 624, in process_recipes
    find_needed_modules(mf, includes=rval['includes'])
  File "build/bdist.macosx-10.6-intel/egg/modulegraph/find_modules.py",
line 182, in find_needed_modules
  File "build/bdist.macosx-10.6-intel/egg/modulegraph/modulegraph.py", line
643, in import_hook
  File "build/bdist.macosx-10.6-intel/egg/modulegraph/modulegraph.py", line
734, in load_tail
ImportError: No module named wx.lib.pubsub.pubsub2
GuanoMac:build_Mac guano$



Still some issues with pubsub..

tks

Carlos



On Sat, Mar 10, 2012 at 13:47, Ronald Oussoren <ronaldoussoren at mac.com>wrote:

>
> On 9 Mar, 2012, at 16:33, Ronald Oussoren wrote:
>
> >
> > On 9 Mar, 2012, at 10:55, Carlos Grohmann wrote:
> >
> >> I think that if the 'excludes' weren't overwritten by the
> >> wx/numpy/matplotlib/etc recipes, it would be easier to fine-tune our
> >> options (maybe run the recipes first and aftrer run the excludes?)
> >
> > The matplotlib issue seems to be a bug that's not related to recipes:
> py2app copies package data into the application bundle, and this code
> accidently also copied all subpackages like the matplotlib.test package.
> I have a patch, but need to test if this actually fixes the bug before I
> commit.
>
> It didn't, but I did make some progress:
>
> 1) I added a py2app recipe that does the right thing with the pubsub
> library in wxPython. That library uses __path__ hacks and that confuses
> modulegraph (and hence py2app). Because of this you no longer have to
> explicitly include 'wx' in the application bundle
>
> 2) I tweaked the matplotlib recipe in py2app, it no longer copies the
> entire package but adds a hook to tell matplotlib where its data is. This
> solution is not fully complete yet, I'm currently including mpl-data twice
> (once in Resources, once in site-packages.zip) and the later copy is not
> needed.
>
> With this the application bundle already shrinks a little (curently 123
> MByte, before I started it was about 160 MByte). About 70 Mbyte of this is
> wx itself (the wxWidgets library and wxPython extensions). Another 21 MByte
> is because all of numpy is included, not just the bits that are actually
> needed. That's because of another py2app recipe which can hopefully be
> improved.
>
> I just pushed updates to modulegraph and py2app to my bitbucket
> repositories.
>
> Ronald
>
> >
> > Ronald
> >
> > _______________________________________________
> > Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> > http://mail.python.org/mailman/listinfo/pythonmac-sig
> > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>
>


-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
---
http://www.igc.usp.br/pessoais/guano
http://www.igc.usp.br/openstereo<http://www.igc.usp.br/index.php?id=openstereo>
http://lattes.cnpq.br/5846052449613692 (CV)
---
Twitter: @CarlosGrohmann
http://carlosgrohmann.tumblr.com/
________________
Can’t stop the signal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20120313/b743670a/attachment.html>


More information about the Pythonmac-SIG mailing list