[Pythonmac-SIG] py2app and mysqldb

Christopher Barker Chris.Barker at noaa.gov
Mon Apr 27 18:39:14 CEST 2009


Elizabeth Lackey wrote:

> I cannot figure out the syntax to edit the setup.py file created by 
> py2applet to allow for the MySQLdb module.

there are a couple ways to pass options in, so it doe3s get hard to 
figure out:

> from setuptools import setup
> 
> APP = ['mac_test.py']
> DATA_FILES = []

PACKAGES = ['A_Package',
             'Another_Package',
             ]

INCLUDES = ['A_Module',
             'Another_Module',
            ]

EXCLUDES = ['A_module_you_don't_want',
            ]

OPTIONS = {'argv_emulation': True,
	   'packages': PACKAGES,
            'includes': INCLUDES,
            'excludes': EXCLUDES,
            }


'packages' includes the entire package -- including all data, etc.
'includes' only includes module, but it's a bit buggy if the module is 
inside a package hierarchy. For instance, if you have:

import packageA.packageB.moduleA

and you include 'packageA.PackageB.moduleA' in py2app, module A will get 
put in the bundle, but at the top level, so it would have to be imported 
by: 'import moduleA'

you can work around that by either adding all of packageA, or, 
specifically including the whole chain:

INCLUDES = ['packageA',
             'packageA.packageB'
             'packageA.packageB.moduleA'
            ]


> setup(
>     app=APP,
>     data_files=DATA_FILES,
>     options={'py2app': OPTIONS},
>     setup_requires=['py2app'],
>     options=dict(py2app=dict(argv_emulation=True),
>     )
> )
> 
> I assume I need to add something along the lines of this, but I can't 
> figure out the syntax
> options=dict(includes=['MySQLdb'])
> 
> Please help!
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Pythonmac-SIG mailing list