[Tutor] Setup.py in program install

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun May 16 04:56:03 EDT 2004



On Sun, 16 May 2004, Isr Gish wrote:

> I find some programs that have a setup.py in them. But wasn't able to
> figure out how and if it's to be used. If someone can explain it, or
> point me to where I can find an explanation, I would appreciate it.

Hi Isr,


Here you go:

    http://docs.python.org/inst/inst.html

'setup.py' is a hook into the distutils third-party module installer;
Python provides a nice way to install third-party modules.  The 'setup.py'
defines a bunch of metadata (author, web site, version, etc...) as well as
the relevant files that need to be copied to make the module work.


Here is an example of a setup.py file (actually taken from the Distutils
itself):

###
setup (name = "Distutils",
       version = "1.1",
       description = "Python Distribution Utilities",
       author = "Greg Ward",
       author_email = "gward at python.net",
       maintainer = "A.M. Kuchling",
       maintainer_email = 'amk at amk.ca',
       url = "http://www.python.org/sigs/distutils-sig/",
       license = "Python",
       long_description = """\
A collection of modules to aid in the distribution and installation of
Python modules, extensions, and (ultimately) applications.  A standard
part of Python 2.x, but also distributed separately for use with
Python 1.5.""",

       # This implies all pure Python modules in ./distutils/ and
       # ./distutils/command/
       packages = ['distutils', 'distutils.command'],
      )
###

So a 'setup.py' defines a lot of metadata, but it also defines what
directory packages should be copied over to 'site-packages' for proper
installation.


In the example above, when we run the 'setup.py' as a stand-alone program,
like this:

    $ python setup.py install

Distutils will read the definitions, and copy over the 'distutils' and
'distutils.command' directories over.


As I remember, we talked about this earlier in private email; you're
running WinCE, right?  I'm not so sure what the status of WinCE and the
Distutils is.  You may want to check with:

    http://mail.python.org/mailman/listinfo/distutils-sig

and see what the status is with WinCE and the Distutils.


Good luck to you!




More information about the Tutor mailing list