From 411ef92ce7934b6f4274b5720aefde8604d9236e Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 20 Jan 2011 18:26:01 +0100 Subject: [PATCH] setup: fix for cython / setuptools integration --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4d20d03d..946e56b6b 100644 --- a/setup.py +++ b/setup.py @@ -54,9 +54,17 @@ if 'sdist' in sys.argv and have_cython: compile(pyx_files) print 'Done !' -#add cython core extension modules if cython is available +# add cython core extension modules if cython is available if have_cython: cmdclass['build_ext'] = build_ext + # this is an hack to make setuptools works with Cython + # without this hack, cython is not executed, and we don't have C files at + # the end. More information can be found at + # http://mail.python.org/pipermail/distutils-sig/2007-September/008204.html + # The solution taken is http://pypi.python.org/pypi/setuptools_cython/ + if 'setuptools.extension' in sys.modules: + m = sys.modules['setuptools.extension'] + m.Extension.__dict__ = m._Extension.__dict__ else: pyx_files = ['%s.c' % x[:-4] for x in pyx_files]