Issue138

Title setuptools.extension incompatible w/ Cython (patch included)
Priority bug Status unread
Superseder Nosy List jim@carroll.com
Assigned To Keywords

Created on 2012-06-12.21:08:13 by jim@carroll.com, last changed 2012-06-12.21:08:13 by jim@carroll.com.

Files
File name Uploaded Type Edit Remove
extension.patch jim@carroll.com, 2012-06-12.21:08:11 text/plain
Messages
msg658 (view) Author: jim@carroll.com Date: 2012-06-12.21:08:11
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
History
Date User Action Args
2012-06-12 21:08:13jim@carroll.comcreate