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
This commit is contained in:
Denis Davydov 2017-03-14 17:48:27 +01:00 committed by Todd Gamblin
parent 8c3edfd36f
commit 560d28ac7f
2 changed files with 5 additions and 14 deletions

View file

@ -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'

View file

@ -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