I've recently go nuts with this issue:
http://www.velocityreviews.com/forums/t693861-cython-setuptools-not-
working-with-pyx-only-with-c-files.html
For what is worth, I solved this explicitly by using:
"""
def get_cython_extfiles(extnames):
extdir = 'tables'
extfiles = {}
for extname in extnames:
extfile = os.path.join(extdir, extname)
extpfile = '%s.pyx' % extfile
extcfile = '%s.c' % extfile
if not exists(extcfile) or newer(extpfile, extcfile):
# For some reason, setup in setuptools does not compile
# Cython files (!) Do that manually...
print "cythoning %s to %s" % (extpfile, extcfile)
os.system("cython %s" % extpfile)
extfiles[extname] = extcfile
return extfiles
cython_extnames = [
'utilsExtension',
'hdf5Extension',
'tableExtension',
'linkExtension',
'_comp_lzo',
'_comp_bzip2' ]
cython_extfiles = get_cython_extfiles(cython_extnames)
"""
and then using extensions like this:
extensions = [
Extension( "tables.utilsExtension",
include_dirs=inc_dirs,
define_macros=def_macros,
sources=[ cython_extfiles['utilsExtension'],
... (other C files),
Hmm, I'm wondering if it would be better if Cython comes with its own
'setup' module. That would make it more resistant to setuptools-like
tools.
--
Francesc Alted
FWIW, I think I heard that this setuptools bug is fixed in distribute (as
are many others).
Stefan
See http://wiki.cython.org/enhancements/distutils_preprocessing This
also handles things like dependency checking for cimports and
includes.
- Robert
Ah, that's great. I'll probably end using this. Thanks!
--
Francesc Alted