[Distutils] A distutils question

Phillip J. Eby pje at telecommunity.com
Thu Dec 8 17:58:47 CET 2005


At 01:58 PM 12/8/2005 +0000, Noel O'Boyle wrote:
>Can someone suggest how I can write a setup.py for a pure-Python
>application that should install on both Linux and Windows?
>
>The application includes a startup script, a package, and some data
>files (or package data) referred to by some modules in the package.
>
>The Linux version will be distributed as a source distribution. The
>Windows version will be distributed as a bdist_wininst, and should
>create a shortcut in the Start Menu folder.
>
>An answer will not only receive my heartfelt thanks, but be
>posted on the web (http://www.redbrick.dcu.ie/~noel/distutils), so that
>others will not have the same problem. A method that will work for both
>Python 2.3 and 2.4 would be the most appreciated.
>
>
>---------contents of development directory
>setup.py
>README
>MANIFEST.in
>license.txt
>src/
>     startupscript.py
>     mypkg/
>         __init__.py
>         module_a.py
>         help.html
>         images/
>             shamrock.png
>
>Regards,
>  Noel

If your question is how to include the data files, you can do it by adding 
something like:

    package_data = {'mypkg': ['*.html', 'images/*.png']},

to your setup() call.  See:

     http://python.org/doc/2.4.1/dist/node11.html

for documentation.

If you want to do this with Python 2.3, however, you'll need to either use 
setuptools, or write a custom extension to the distutils install_data 
command, as the Python 2.3 distutils don't support the package_data option 
(which was originally developed in setuptools and then added to the 2.4 
distutils).



More information about the Distutils-SIG mailing list