Search code examples
pythondistutils

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


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'))]
)

Solution

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

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