Rene Liebscher wrote:
Mike Fletcher wrote:
I've just noticed that with PyOpenGL, changing a source file that's included by the "declared" source file for an extension doesn't cause the recompilation of the extension.
i.e. _openglmodule.c _opengl_nummodule.c # includes _openglmodule.c
The extension only declares _opengl_nummodule.c as a source file. Is there some way to declare that the "rule" for the extension should trigger if the given file has changed?
AFAIK there is no way to do so. Correct.
But I think it would be easy to add it to distutils. This of course means that it is also easy to add it to the setup-script, since you can override the distutils commands with your own. class my_build_ext(distutils.command.build_ext): ...
setup(... cmdclass = {'build_ext': my_build_ext}, ...)
First we need to extend the Extension class to hold the names of files on which the extension depends. (This would mean included c-files, header-files ...)
It could look like this: Extension( sources=["foo.c"], depends_on=["config.h","bar.c"], ... ) or for Mike's example Extension( sources=["_opengl_nummodule.c"], depends_on=["_openglmodule.c"], ... )
IMO better would be to let sources be instances of a SourceFile class, which would depend on other (Source)files. Thomas