diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index fb5d70f34f..4984a28926 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -446,10 +446,11 @@ def determine_variants(cls, exes, version): # Get the appropriate compiler match = re.search(r'\bC compiler absolute: (\S+)', output) - compiler_spec = get_spack_compiler_spec( - os.path.dirname(match.group(1))) - if compiler_spec: - variants += "%" + str(compiler_spec) + if match: + compiler_spec = get_spack_compiler_spec( + os.path.dirname(match.group(1))) + if compiler_spec: + variants += "%" + str(compiler_spec) results.append(variants) return results