[Distutils] include files with C extensions

Antoine Pitrou antoine.pitrou at wengo.fr
Mon Nov 27 14:59:14 CET 2006


I've got a small problem with the C extension feature. It happens when
your C (or Pyrex) extension is spread across several C sources, and you
have a custom .h file to make the glue. Say:

    ext_modules = [
        Extension('mycext', [
                'src/custom1.c', 'src/custom2.c',

Let's say custom1.c and custom2.c both include src/custom.h. The problem
is when you only change src/custom.h without changing one of the C
files. Setuptools does not know that custom.h is part of the C extension
code, thus "setup.py build" doesn't rebuild it. Even trying "setup.py
clean build" does not result into an actual rebuild.

Also, including "src/custom.h" into the extension file list does not
work, setuptools complaining that it doesn't know about ".h" files.

Is there a clean way to have setuptools do a rebuild when the .h file is



More information about the Distutils-SIG mailing list