We discovered a minor problem with setuptools.extension.py that prevents being able to incrementally build extenion modules when working with Cython (meaning, edits to source do NOT result in a call to the cython compiler).
A patch is attached to this ticket.
The problem is the extension.Extension() class has logic that alters the filename the sources[] list if Pyrex is not installed. The code has a simple boolean test if Pyrex is installed, and if not, it remaps the extension from ".pyx" -> ".c".
I believe the simple solution is to perform the same logic for Cython (to set a boolean if Cython is available, and to NOT remap the source extension if either Pyrex OR Cython is installed).
Example to demonstrate the problem:
setup('project',
...,
ext_modules = Extension('Prj', ['Prj/pr1.pyx']),
...,
cmdclass = {'build_ext': Cython.Distutils.build_ext},
...,
With a setup.py like this, the setuptools.extension.Extension class will re-write the sources[] list BEFORE the Cython.Distutils.build_ext module can get a shot at it.
The result is that subsequent edits of 'Prj/pr1.pyx' will cause build_ext to skip the cython compile step. The only work around to force a recompile is to delete the contents of the 'build/' folder.
See the suggested patch for our request for modification.
Thanks
|