[Distutils] installing data files and headers

A.M. Kuchling amk@amk.ca
Fri Feb 28 20:40:02 2003

On Fri, Feb 28, 2003 at 10:31:00AM -0500, Jeremy Hylton wrote:
>Another problem we've been struggling with for Zope projects is that
>distutils really only installs Python modules and extensions.  It's
>support for data files and C header files is pretty limited.  We've got

Good idea.  We have a similar subclass for Quixote that installs *.ptl
files, and it's a common need.

>installed, so that you don't install .py~ files.  One possibility is to
>explicitly list the file extensions that constitute installable data. 
>We did that for Zope3, but the list of extensions ended up being fairly

Well, what are the options?

1) List extensions.  
2) Explicitly list pathnames for additional files.
3) A MANIFEST.in-like mini-language for specifying which files should 
   be installed.
4) Automatically add things in package directories that 
   aren't obviously irrelevant (*~, *.pyc, CVS, .svn).

Any other ideas?

4) probably offers too little control, and 3) might be too much, and
adds yet another file to write.  What if both 1) and 2) were
supported, say, like this:

      package_files=['zope/app/config.xml', 'zope/app/dtd.xml'],

So this adds all *.cfg files in any package directory, and the two XML
files.  We could also allow arbitrary filenames in the 'py_modules'
list, but then the very name 'py_modules' is misleading, so IMHO
that's a bad idea.  

One nit is that packages are identified as 'zope.app' in the
'packages' and 'package_dir' keywords.  build_py will have to mess
around with the package_files strings, but hopefully that won't be too
difficult to get right.

>The other problem we have is with header files.  We'd like to have .h
>files that are installed inside a directory in /usr/local/include.  For

Why isn't installing the headers in /usr/local/python2.2/persistence
OK?  Are these headers completely independent of Python (e.g. for a
standalone C library)?

--amk                                                             (www.amk.ca)
I never think twice about anything; takes too much time.
      -- Sanders, in "Kinda"