diff options
author | Michael Hirsch <scivision@users.noreply.github.com> | 2020-06-01 12:29:32 -0400 |
---|---|---|
committer | Michael Hirsch <scivision@users.noreply.github.com> | 2020-06-02 12:28:11 -0400 |
commit | 6deecb9e5a13a51f2e27a7af34aa1868f0330f6a (patch) | |
tree | fec9d86584a6468a95d039c497a2474562e23e92 | |
parent | 211d5c193113f3e49e18422bd9926db9fb07f78b (diff) | |
download | numpy-6deecb9e5a13a51f2e27a7af34aa1868f0330f6a.tar.gz |
BUG: gcc >= 10: correctly compare major version
The comparison of GCC major version used a string
comparison, which is known to break when comparing
single vs. double version numbers. This fix
compares the integer of the major GCC version.
Before this fix, GCC/Gfortran 10 would get inappropriate
flag "-mno-cygwin" applied, which was removed in GCC 4
and makes GCC error out.
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 796dff351..23d905393 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -10,6 +10,7 @@ import subprocess from subprocess import Popen, PIPE, STDOUT from numpy.distutils.exec_command import filepath_from_subprocess_output from numpy.distutils.fcompiler import FCompiler +from distutils.version import LooseVersion compilers = ['GnuFCompiler', 'Gnu95FCompiler'] @@ -273,7 +274,7 @@ class Gnu95FCompiler(GnuFCompiler): if not v or v[0] != 'gfortran': return None v = v[1] - if v >= '4.': + if LooseVersion(v) >= "4": # gcc-4 series releases do not support -mno-cygwin option pass else: |