aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/extension.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-31 10:51:55 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-31 10:51:55 -0500
commit29fa01621c3de0a5c78c4f49b5d051386d0d566f (patch)
treefce7387c8ba82178be987b004cbda1c22005a04f /setuptools/extension.py
parent928324bd76f35e9c8c526df828577b5640a95ed0 (diff)
parent6bdbe8957d8c8d293e3fea3fa4baf45eb7c3a3a4 (diff)
downloadexternal_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.gz
external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.bz2
external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.zip
Merge with master. Ref #229.
--HG-- branch : feature/issue-229
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 ''