From 4f2947a7d6c00d04dbeb76c8d04ca7b16972eddb Mon Sep 17 00:00:00 2001 From: MinRK Date: Thu, 23 Aug 2012 11:22:31 -0700 Subject: [PATCH] undo dumb setuptools bug clobbering .pyx sources back to .c setuptools (not distribute) will replace '.pyx' extensions with '.c' if *pyrex* is not importable. This checks if that happened, and reverses it if so. closes #1805 --- setup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.py b/setup.py index 5e9d070982242..9a6c42e511545 100755 --- a/setup.py +++ b/setup.py @@ -403,6 +403,14 @@ def srcpath(name=None, suffix='.pyx', subdir='src'): if not ISRELEASED: extensions.extend([sandbox_ext]) +if suffix == '.pyx' and 'setuptools' in sys.modules: + # undo dumb setuptools bug clobbering .pyx sources back to .c + for ext in extensions: + if ext.sources[0].endswith('.c'): + root, _ = os.path.splitext(ext.sources[0]) + ext.sources[0] = root + suffix + + # if _have_setuptools: # setuptools_kwargs["test_suite"] = "nose.collector"