diff options
Diffstat (limited to 'setuptools/extension.py')
-rw-r--r-- | setuptools/extension.py | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/setuptools/extension.py b/setuptools/extension.py index df1ef02a..980ee0a7 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -2,20 +2,16 @@ from distutils.core import Extension as _Extension from setuptools.dist import _get_unpatched _Extension = _get_unpatched(_Extension) -try: - # testing Cython first as it is supposed to replace pyrex - from Cython.Distutils.build_ext import build_ext -except ImportError: - try: - from Pyrex.Distutils.build_ext import build_ext - except: - have_pyrex = False - else: - has_pyrex = True - - have_pyrex = False -else: - have_pyrex = True +# Prefer Cython to Pyrex +pyrex_impls = 'Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext' +for pyrex_impl in pyrex_impls: + try: + # from (pyrex_impl) import build_ext + build_ext = __import__(pyrex_impl, fromlist=['build_ext']).build_ext + break + except: + pass +have_pyrex = 'build_ext' in globals() class Extension(_Extension): |