summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2016-01-06 20:31:02 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2016-01-06 21:58:10 +0100
commit1d1eaef896a66059163f0baaaaa162e1f7c225a9 (patch)
treece0f6b9886790b0c9266043ee3dacaf05fe1d79b /numpy
parent6c742bdfecdb0c6cebdce2be0ae189fb149cd82a (diff)
downloadnumpy-1d1eaef896a66059163f0baaaaa162e1f7c225a9.tar.gz
MAINT: remove outdated Pyrex support from distutils (as far as possible).
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/command/build_src.py47
-rw-r--r--numpy/distutils/setup.py1
-rw-r--r--numpy/distutils/tests/pyrex_ext/__init__.py1
-rw-r--r--numpy/distutils/tests/pyrex_ext/primes.pyx22
-rw-r--r--numpy/distutils/tests/pyrex_ext/setup.py14
-rw-r--r--numpy/distutils/tests/pyrex_ext/tests/test_primes.py13
-rw-r--r--numpy/distutils/tests/setup.py2
-rw-r--r--numpy/testing/nosetester.py1
8 files changed, 9 insertions, 92 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 = []
diff --git a/numpy/distutils/setup.py b/numpy/distutils/setup.py
index 82a53bd08..eac9c0f18 100644
--- a/numpy/distutils/setup.py
+++ b/numpy/distutils/setup.py
@@ -6,6 +6,7 @@ def configuration(parent_package='',top_path=None):
config = Configuration('distutils', parent_package, top_path)
config.add_subpackage('command')
config.add_subpackage('fcompiler')
+ config.add_subpackage('tests')
config.add_data_dir('tests')
config.add_data_files('site.cfg')
config.add_data_files('mingw/gfortran_vs2003_hack.c')
diff --git a/numpy/distutils/tests/pyrex_ext/__init__.py b/numpy/distutils/tests/pyrex_ext/__init__.py
deleted file mode 100644
index 1d0f69b67..000000000
--- a/numpy/distutils/tests/pyrex_ext/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import division, absolute_import, print_function
diff --git a/numpy/distutils/tests/pyrex_ext/primes.pyx b/numpy/distutils/tests/pyrex_ext/primes.pyx
deleted file mode 100644
index 2ada0c5a0..000000000
--- a/numpy/distutils/tests/pyrex_ext/primes.pyx
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Calculate prime numbers
-#
-
-def primes(int kmax):
- cdef int n, k, i
- cdef int p[1000]
- result = []
- if kmax > 1000:
- kmax = 1000
- k = 0
- n = 2
- while k < kmax:
- i = 0
- while i < k and n % p[i] <> 0:
- i = i + 1
- if i == k:
- p[k] = n
- k = k + 1
- result.append(n)
- n = n + 1
- return result
diff --git a/numpy/distutils/tests/pyrex_ext/setup.py b/numpy/distutils/tests/pyrex_ext/setup.py
deleted file mode 100644
index 819dd3154..000000000
--- a/numpy/distutils/tests/pyrex_ext/setup.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-from __future__ import division, print_function
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('pyrex_ext', parent_package, top_path)
- config.add_extension('primes',
- ['primes.pyx'])
- config.add_data_dir('tests')
- return config
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/distutils/tests/pyrex_ext/tests/test_primes.py b/numpy/distutils/tests/pyrex_ext/tests/test_primes.py
deleted file mode 100644
index 1ae436b65..000000000
--- a/numpy/distutils/tests/pyrex_ext/tests/test_primes.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from __future__ import division, absolute_import, print_function
-
-from numpy.testing import TestCase, run_module_suite, assert_equal
-from pyrex_ext.primes import primes
-
-class TestPrimes(TestCase):
- def test_simple(self, level=1):
- l = primes(10)
- assert_equal(l, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29])
-
-
-if __name__ == "__main__":
- run_module_suite()
diff --git a/numpy/distutils/tests/setup.py b/numpy/distutils/tests/setup.py
index 135de7c47..07bafb0b7 100644
--- a/numpy/distutils/tests/setup.py
+++ b/numpy/distutils/tests/setup.py
@@ -4,9 +4,7 @@ from __future__ import division, print_function
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('testnumpydistutils', parent_package, top_path)
- config.add_subpackage('pyrex_ext')
config.add_subpackage('f2py_ext')
- #config.add_subpackage('f2py_f90_ext')
config.add_subpackage('swig_ext')
config.add_subpackage('gen_ext')
return config
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py
index 42113676a..23ba8cc3a 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -171,7 +171,6 @@ class NoseTester(object):
excludes = ['f2py_ext',
'f2py_f90_ext',
'gen_ext',
- 'pyrex_ext',
'swig_ext']
def __init__(self, package=None, raise_warnings="release", depth=0):