How to specify header files in setup.py script for Python extension module?

Johan Råde picture Johan Råde · Jul 9, 2011 · Viewed 11.5k times · Source

How do I specify the header files in a setup.py script for a Python extension module? Listing them with source files as follows does not work. But I can not figure out where else to list them.

from distutils.core import setup, Extension
from glob import glob

setup(
    name = "Foo",
    version = "0.1.0",
    ext_modules = [Extension('Foo', glob('Foo/*.cpp') + glob('Foo/*.h'))]
)

Answer

iElectric picture iElectric · Jul 13, 2011

Add MANIFEST.in file besides setup.py with following contents:

graft relative/path/to/directory/of/your/headers/