[Distutils] distutils question

Phillip J. Eby pje at telecommunity.com
Sun Oct 17 14:03:24 CEST 2004


At 10:48 PM 10/16/04 -0700, Craig wrote:
>Hi - I'm trying to use distutils to set up a package that has lots of 
>config files that are co-located with the package itself. The problem I'm 
>having is how to install these files in the same place as my python 
>package. The following ugly hack is what I came up with, but I can't 
>believe there isn't a better way. If it matters, the platforms I'm using 
>are windows and linux.

There is a better way.  For Python 2.4, there's a new 'package_data' option
to the 'setup()' function.  See:

     http://www.python.org/dev/doc/devel/dist/node11.html

for details.

If you can't wait for Python 2.4, you can use the 'setuptools' package, 
which is available in the Python CVS "sandbox" 
(python/nondist/sandbox).  Instead of importing 'setup' from 
'distutils.core', just import it from 'setuptools'.  The 'setup.py' for 
'setuptools' actually uses setuptools, so you can use it as an example.

If the target system won't have setuptools installed ahead of time, you'll 
need to include setuptools itself in your source distribution, installed in 
the main directory of the distribution.  Be sure to add a:

     recursive-include setuptools *.py

to your MANIFEST.in, so that it will be included when you build a source 
distribution of your package.




More information about the Distutils-SIG mailing list