distutils, extensions, and missing headers

Robert Kern robert.kern at gmail.com
Thu Sep 20 03:22:50 EDT 2007


Gary Jefferson wrote:
> My setup.py (with extension) seems to work great for build and
> install, but for bdist_rpm, compilation of the extension fails because
> some of the headers needed to build the extension aren't in the bdist
> tarball.
> 
> I've tried adding a 'depends=[]' to the Extension definition with
> these header files present, but they still don't get put in the
> tarball.
> 
> What's the key to getting headers or other [non-python] files included
> in a bdist?

Use the "headers" keyword to setup() to list the header files you want installed.

For other files, it depends on where you need them to go. If you want the data
files to be inside the package, you should use the "package_data" keyword. It
was introduced in Python 2.4, so if you need to support pre-2.4 Pythons, there
are recipes floating around to do so more nicely.

  http://docs.python.org/dist/node12.html

For other things (and hopefully, you can live with package data), use "data_files":

  http://docs.python.org/dist/node13.html

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list