aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/extension.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/extension.py')
-rw-r--r--setuptools/extension.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/setuptools/extension.py b/setuptools/extension.py
index 8178ed33..35eb7c7c 100644
--- a/setuptools/extension.py
+++ b/setuptools/extension.py
@@ -12,35 +12,33 @@ _Extension = _get_unpatched(distutils.core.Extension)
msvc9_support.patch_for_specialized_compiler()
-def have_pyrex():
+def _have_cython():
"""
- Return True if Cython or Pyrex can be imported.
+ Return True if Cython can be imported.
"""
- pyrex_impls = 'Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext'
- for pyrex_impl in pyrex_impls:
- try:
- # from (pyrex_impl) import build_ext
- __import__(pyrex_impl, fromlist=['build_ext']).build_ext
- return True
- except Exception:
- pass
+ cython_impl = 'Cython.Distutils.build_ext',
+ try:
+ # from (cython_impl) import build_ext
+ __import__(cython_impl, fromlist=['build_ext']).build_ext
+ return True
+ except Exception:
+ pass
return False
+# for compatibility
+have_pyrex = _have_cython
+
class Extension(_Extension):
"""Extension that uses '.c' files in place of '.pyx' files"""
- def __init__(self, *args, **kw):
- _Extension.__init__(self, *args, **kw)
- self._convert_pyx_sources_to_lang()
-
def _convert_pyx_sources_to_lang(self):
"""
Replace sources with .pyx extensions to sources with the target
language extension. This mechanism allows language authors to supply
pre-converted sources but to prefer the .pyx sources.
"""
- if have_pyrex():
+ if _have_cython():
# the build has Cython, so allow it to compile the .pyx files
return
lang = self.language or ''