[Pythonmac-SIG] [Numpy-discussion] Packaging numpy with py2app

Bob Ippolito bob at redivi.com
Tue Jul 18 01:49:14 CEST 2006


On Jul 17, 2006, at 4:34 PM, Christopher Barker wrote:

> OK,
>
> As is usual with this stuff, I've figured it out. I poked into some of
> the py2app examples, and found one with py2app options set. Here's  
> what
> works (at least with svn trunk, I haven't tried it with 0.3.1):
>
> #!/usr/bin/env python2.4
> """
> setup.py - script for building Simple CameoWeb test
>
> Usage:
>      % python setup.py py2app
> """
> from distutils.core import setup
> import py2app
>
> setup(
>      app = [dict(script = 'NumpyTest.py',
>                  packages = ['numpy']
>                  #plist = plist,
>                  )],
>       options=dict(py2app=dict(
>            #includes=['testpkg.*'],
>            packages=['numpy'],
>       )),
>          setup_requires=["py2app"],
> )
>
> What is "setup_requires" I just stuck it in there, as it was in all  
> the
> examples.

http://peak.telecommunity.com/DevCenter/setuptools#new-and-changed- 
setup-keywords

"""
setup_requires
A string or list of strings specifying what other distributions need  
to be present in order for the setup script to run. setuptools will  
attempt to obtain these (even going so far as to download them using  
EasyInstall) before processing the rest of the setup script or  
commands. This argument is needed if you are using distutils  
extensions as part of your build process; for example, extensions  
that process setup() arguments and turn them into EGG-INFO metadata  
files.

(Note: projects listed in setup_requires will NOT be automatically  
installed on the system where the setup script is being run. They are  
simply downloaded to the setup directory if they're not locally  
available already. If you want them to be installed, as well as being  
available when the setup script is run, you should add them to  
install_requires and setup_requires.)

"""


If someone has setuptools installed but not py2app, this would also  
ensure that py2app is downloaded and usable. It also makes absolutely  
sure that setuptools sees the py2app egg's entry points and adds the  
"py2app" command and "app" and "plugin" keywords to setup().

Your script isn't strictly correct either, it should be:

from setuptools import setup
setup(...)

None of the examples explicitly import py2app or distutils (except  
the wxGlade one, which imports py2app to add a recipe).

-bob





More information about the Pythonmac-SIG mailing list