From 560d28ac7f138d7390dafc100728fce2640d8a35 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 14 Mar 2017 17:48:27 +0100 Subject: [PATCH] fix automatic mixing of clang with gfortran 6.3.0 on macOS (#3427) * fix automatic mixing of clang with gfortran 6.3.0 on macOS * automatically mix any gfortran with any clang on macOS * adjust the unit test --- lib/spack/spack/compilers/clang.py | 15 +++------------ lib/spack/spack/test/cmd/test_compiler_cmd.py | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 3d68a37c44..f2f0883b20 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -164,19 +164,10 @@ def _find_full_path(self, path): @classmethod def fc_version(cls, fc): - version = get_compiler_version( - fc, '-dumpversion', - # older gfortran versions don't have simple dumpversion output. - r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)') - # This is horribly ad hoc, we need to map from gcc/gfortran version - # to clang version, but there could be multiple clang - # versions that work for a single gcc/gfortran version + # We could map from gcc/gfortran version to clang version, but on macOS + # we normally mix any version of gfortran with any version of clang. if sys.platform == 'darwin': - clangversionfromgcc = {'6.2.0': '8.0.0-apple'} - else: - clangversionfromgcc = {} - if version in clangversionfromgcc: - return clangversionfromgcc[version] + return cls.default_version('clang') else: return 'unknown' diff --git a/lib/spack/spack/test/cmd/test_compiler_cmd.py b/lib/spack/spack/test/cmd/test_compiler_cmd.py index f0160e274a..842b64039e 100644 --- a/lib/spack/spack/test/cmd/test_compiler_cmd.py +++ b/lib/spack/spack/test/cmd/test_compiler_cmd.py @@ -90,5 +90,5 @@ def test_compiler_add(self, mock_compiler_dir): new_compilers = set(spack.compilers.all_compiler_specs()) new_compiler = new_compilers - old_compilers assert new_compiler - c = new_compiler.pop() - assert c.version == Version(test_version) + assert sum(1 for c in new_compiler if + c.version == Version(test_version)) > 0