diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2016-01-06 20:31:02 +0100 |
---|---|---|
committer | Ralf Gommers <ralf.gommers@gmail.com> | 2016-01-06 21:58:10 +0100 |
commit | 1d1eaef896a66059163f0baaaaa162e1f7c225a9 (patch) | |
tree | ce0f6b9886790b0c9266043ee3dacaf05fe1d79b /numpy/distutils/command/build_src.py | |
parent | 6c742bdfecdb0c6cebdce2be0ae189fb149cd82a (diff) | |
download | numpy-1d1eaef896a66059163f0baaaaa162e1f7c225a9.tar.gz |
MAINT: remove outdated Pyrex support from distutils (as far as possible).
Diffstat (limited to 'numpy/distutils/command/build_src.py')
-rw-r--r-- | numpy/distutils/command/build_src.py | 47 |
1 files changed, 8 insertions, 39 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py index 7463a0e17..2efcdea60 100644 --- a/numpy/distutils/command/build_src.py +++ b/numpy/distutils/command/build_src.py @@ -1,4 +1,4 @@ -""" Build swig, f2py, pyrex sources. +""" Build swig and f2py sources. """ from __future__ import division, absolute_import, print_function @@ -13,12 +13,6 @@ from distutils.dep_util import newer_group, newer from distutils.util import get_platform from distutils.errors import DistutilsError, DistutilsSetupError -def have_pyrex(): - try: - import Pyrex.Compiler.Main - return True - except ImportError: - return False # this import can't be done here, as it uses numpy stuff only available # after it's installed @@ -327,13 +321,9 @@ class build_src(build_ext.build_ext): self.ext_target_dir = self.get_package_dir(package) sources = self.generate_sources(sources, ext) - sources = self.template_sources(sources, ext) - sources = self.swig_sources(sources, ext) - sources = self.f2py_sources(sources, ext) - sources = self.pyrex_sources(sources, ext) sources, py_files = self.filter_py_files(sources) @@ -450,6 +440,7 @@ class build_src(build_ext.build_ext): return new_sources def pyrex_sources(self, sources, extension): + """Pyrex not supported; this remains for Cython support (see below)""" new_sources = [] ext_name = extension.name.split('.')[-1] for source in sources: @@ -464,34 +455,12 @@ class build_src(build_ext.build_ext): return new_sources def generate_a_pyrex_source(self, base, ext_name, source, extension): - if self.inplace or not have_pyrex(): - target_dir = os.path.dirname(base) - else: - target_dir = appendpath(self.build_src, os.path.dirname(base)) - target_file = os.path.join(target_dir, ext_name + '.c') - depends = [source] + extension.depends - if self.force or newer_group(depends, target_file, 'newer'): - if have_pyrex(): - import Pyrex.Compiler.Main - log.info("pyrexc:> %s" % (target_file)) - self.mkpath(target_dir) - options = Pyrex.Compiler.Main.CompilationOptions( - defaults=Pyrex.Compiler.Main.default_options, - include_path=extension.include_dirs, - output_file=target_file) - pyrex_result = Pyrex.Compiler.Main.compile(source, - options=options) - if pyrex_result.num_errors != 0: - raise DistutilsError("%d errors while compiling %r with Pyrex" \ - % (pyrex_result.num_errors, source)) - elif os.path.isfile(target_file): - log.warn("Pyrex required for compiling %r but not available,"\ - " using old target %r"\ - % (source, target_file)) - else: - raise DistutilsError("Pyrex required for compiling %r"\ - " but notavailable" % (source,)) - return target_file + """Pyrex is not supported, but some projects monkeypatch this method. + + That allows compiling Cython code, see gh-6955. + This method will remain here for compatibility reasons. + """ + return [] def f2py_sources(self, sources, extension): new_sources = [] |