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

Carlos Grohmann carlos.grohmann at gmail.com
Thu Mar 8 00:09:28 CET 2012


Hi there,

I've been reasonably successful in building an app bundle with py2app.
I'm running OS X Lion, python 2.7.2 (from python.org), wxpython
2.9beta, and my app
uses matplotlib and numpy.

Using py2exe, the final folder has 14MB, or 11MB compressed.

Using py2app, the .app has 250MB (!) or 100MB compressed with Disk utility

Examining the Contents of the .app, I can see that there's A LOT of
stuff I don't need,
like Editra (11MB), Locales, or Matplotlib "tests" folder (38MB)

So, how could I remove these itens from my app?
I tried the 'excludes' option in py2app setup.py, but without any luck.

Also, what are those "codecs" in lib-dynload? I have no idea what they are.

my setup.py follows. (BTW, I tried to run it without any reference to
'wx' but then
the app crashes)

many thanks

Carlos





from setuptools import setup
from glob import glob

import shutil
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)

APPNAME = 'OpenStereo'
APP = ['resources/OpenStereo.py']
VERSION = '0.1.2g' # must be in X.X.X format

DATA_FILES = ['license/gpl-3.0.txt'] #[glob(r'resources/*')]

OPTIONS = {
            'plist':dict(
            CFBundleName                = 'OpenStereo',
            CFBundleShortVersionString  = VERSION,
            CFBundleVersion             = VERSION,
            CFBundleGetInfoString       = 'OpenStereo, Open-Source
Structural Geology Analysis',
            CFBundleExecutable          = 'OpenStereo',
            CFBundleIdentifier          = "br.usp.igc",
            NSHumanReadableCopyright    = 'Carlos H. Grohmann'),

            'argv_emulation': True,
            'optimize': 1,
            'compressed': True,
            'strip': True,
            'semi_standalone': False,
            'packages': ['wx'],
            'dylib_excludes': ['Tcl.framework','Tk.framework'],
            'resources': ['icons/openstereo_icon_noname_256x256x32.png'],
            'iconfile': 'icons/openstereo_icon_noname.icns',
            }

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)






-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
---
http://www.igc.usp.br/pessoais/guano
http://digitalelevation.wordpress.com/
http://lattes.cnpq.br/5846052449613692 (CV)
---
Twitter: @CarlosGrohmann
http://carlosgrohmann.tumblr.com/
________________
Can’t stop the signal.


More information about the Pythonmac-SIG mailing list