diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-06-10 12:33:54 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-06-10 12:33:54 -0400 |
commit | a811c089a4362c0dc6c4a84b708953dde9ebdbf8 (patch) | |
tree | e3affecd9b7ed8266bc61624d686d7a49ad2671f /setuptools/extension.py | |
parent | c1d71724e6f73eec022cb86161cf777ff37b009b (diff) | |
download | external_python_setuptools-a811c089a4362c0dc6c4a84b708953dde9ebdbf8.tar.gz external_python_setuptools-a811c089a4362c0dc6c4a84b708953dde9ebdbf8.tar.bz2 external_python_setuptools-a811c089a4362c0dc6c4a84b708953dde9ebdbf8.zip |
Detect Cython later in the build process, allowing the library to be specified in setup_requires. Fixes #288.
Diffstat (limited to 'setuptools/extension.py')
-rw-r--r-- | setuptools/extension.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/setuptools/extension.py b/setuptools/extension.py index 8178ed33..a7c40f86 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -12,35 +12,34 @@ _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: + cython_impls = 'Cython.Distutils.build_ext', + for cython_impl in cython_impls: try: - # from (pyrex_impl) import build_ext - __import__(pyrex_impl, fromlist=['build_ext']).build_ext + # 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 '' |