Hello devs, I'm developing the setup.py for a scientific package, MDAnalysis <https://github.com/MDAnalysis/mdanalysis/> (see PR #799 <https://github.com/MDAnalysis/mdanalysis/pull/799>). We depend on distutils and setuptool. Namely, we use setuptools.extension.Extension class for our extensions.
Some older versions of setuptools (<18.0) do filename cythonization themselves upon initialization of the Extension object. Because we want to control name cythonization ourselves I try to directly use distutils.extension.Extension, which has none of setuptools' cythonization. However, this doesn't work because setuptools patches distutils, so that distutils.extension.Extension effectively becomes setuptools.extension.Extension. setuptools does provide a copy of the unpatched Extension class, via setuptools.extension._Extension. Yet, if I attempt to pass instances of this class to Cython.cythonize it fails because my extension parent no longer conforms to one of the expected classes: File "./setup.py", line 283, in cythonize new_ext_modules = Cython.cythonize(self.ext_modules) File "/scratch/virtualenv/lib/python2.7/site-packages/Cython-0.24-py2.7-linux-x86_64.egg/Cython/Build/Dependencies.py", line 796, in cythonize aliases=aliases) File "/scratch/virtualenv/lib/python2.7/site-packages/Cython-0.24-py2.7-linux-x86_64.egg/Cython/Build/Dependencies.py", line 686, in create_extension_list raise TypeError(msg) TypeError: pattern is not of type str nor subclass of Extension (<class setuptools.extension.Extension at 0x7f66be4e2a78>) but of type <type 'instance'> and class distutils.extension.Extension I believe cythonize should be more permissive with the extension parent classes it accepts, or at least have the setuptools _Extension one in the whitelist, since it's the only way to access the original distutils class. What do you think? In the meantime I'll solve this by subclassing setuptools.extension.Extension and making sure it doesn't cythonize anything. Cheers, Manuel
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel