Commit c60c5df2 authored by Jason R. Coombs's avatar Jason R. Coombs

Refactored Cython/Pyrex optional build support to unify logic

--HG--
branch : distribute
extra : rebase_source : c924cf1817736349e9a254098b6d99cd97a3d35f
parent 0cb7fa26
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment