Fix for GitHub #95
develop: compiler clang@unknown created for /usr/bin/clang-format https://github.com/scalability-llnl/spack/issues/95
This commit is contained in:
parent
6af49d41fd
commit
c5c9ada7b0
@ -227,14 +227,32 @@ def find(cls, *path):
|
|||||||
for d in dicts:
|
for d in dicts:
|
||||||
all_keys.update(d)
|
all_keys.update(d)
|
||||||
|
|
||||||
compilers = []
|
compilers = {}
|
||||||
for k in all_keys:
|
for k in all_keys:
|
||||||
ver, pre, suf = k
|
ver, pre, suf = k
|
||||||
|
|
||||||
|
# Skip compilers with unknown version.
|
||||||
|
if ver == 'unknown':
|
||||||
|
continue
|
||||||
|
|
||||||
paths = tuple(pn[k] if k in pn else None for pn in dicts)
|
paths = tuple(pn[k] if k in pn else None for pn in dicts)
|
||||||
spec = spack.spec.CompilerSpec(cls.name, ver)
|
spec = spack.spec.CompilerSpec(cls.name, ver)
|
||||||
compilers.append(cls(spec, *paths))
|
|
||||||
|
|
||||||
return compilers
|
if ver in compilers:
|
||||||
|
prev = compilers[ver]
|
||||||
|
|
||||||
|
# prefer the one with more compilers.
|
||||||
|
prev_paths = [prev.cc, prev.cxx, prev.f77, prev.fc]
|
||||||
|
newcount = len([p for p in paths if p is not None])
|
||||||
|
prevcount = len([p for p in prev_paths if p is not None])
|
||||||
|
|
||||||
|
# Don't add if it's not an improvement over prev compiler.
|
||||||
|
if newcount <= prevcount:
|
||||||
|
continue
|
||||||
|
|
||||||
|
compilers[ver] = cls(spec, *paths)
|
||||||
|
|
||||||
|
return list(compilers.values())
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user