summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2007-04-22 20:57:58 +0000
committercookedm <cookedm@localhost>2007-04-22 20:57:58 +0000
commit06cc6933dfdae2f9273c3040b2677e2206221647 (patch)
tree1666790a68a01261c2b5c7c8067ae468e6d30243 /numpy/distutils/tests
parentfcb7fd261eb0e73fb8abba78e692aca0ba00ce82 (diff)
downloadnumpy-06cc6933dfdae2f9273c3040b2677e2206221647.tar.gz
Better version handling for gnu and intel Fortran compilers
- gnu compilers check if the version is >= 4, in which case it's gfortran - add a test file for gnu compiler check - simplify version matching on intel compilers to be more flexible - add FCompiler.find_executables so that subclasses can find executables at .customize() time, instead of when the class is created.
Diffstat (limited to 'numpy/distutils/tests')
-rw-r--r--numpy/distutils/tests/test_fcompiler_gnu.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/numpy/distutils/tests/test_fcompiler_gnu.py b/numpy/distutils/tests/test_fcompiler_gnu.py
new file mode 100644
index 000000000..c6ccea054
--- /dev/null
+++ b/numpy/distutils/tests/test_fcompiler_gnu.py
@@ -0,0 +1,52 @@
+from numpy.testing import *
+
+set_package_path()
+import numpy.distutils.fcompiler
+restore_path()
+
+g77_version_strings = [
+ ('GNU Fortran 0.5.25 20010319 (prerelease)', '0.5.25'),
+ ('GNU Fortran (GCC 3.2) 3.2 20020814 (release)', '3.2'),
+ ('GNU Fortran (GCC) 3.3.3 20040110 (prerelease) (Debian)', '3.3.3'),
+ ('GNU Fortran (GCC) 3.3.3 (Debian 20040401)', '3.3.3'),
+ ('GNU Fortran (GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) 3.2.2'
+ ' 20030222 (Red Hat Linux 3.2.2-5)', '3.2.2'),
+]
+
+gfortran_version_strings = [
+ ('GNU Fortran 95 (GCC 4.0.3 20051023 (prerelease) (Debian 4.0.2-3))',
+ '4.0.3'),
+ ('GNU Fortran 95 (GCC) 4.1.0', '4.1.0'),
+ ('GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental)', '4.2.0'),
+ ('GNU Fortran (GCC) 4.3.0 20070316 (experimental)', '4.3.0'),
+]
+
+class test_g77_versions(NumpyTestCase):
+ def test_g77_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu')
+ for vs, version in g77_version_strings:
+ v = fc.version_match(vs)
+ assert v == version, (vs, v)
+
+ def test_not_g77(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu')
+ for vs, _ in gfortran_version_strings:
+ v = fc.version_match(vs)
+ assert v is None, (vs, v)
+
+class test_gortran_versions(NumpyTestCase):
+ def test_gfortran_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95')
+ for vs, version in gfortran_version_strings:
+ v = fc.version_match(vs)
+ assert v == version, (vs, v)
+
+ def test_not_gfortran(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95')
+ for vs, _ in g77_version_strings:
+ v = fc.version_match(vs)
+ assert v is None, (vs, v)
+
+
+if __name__ == '__main__':
+ NumpyTest.run()