compiler.py: be more defensive (#50403)
This commit is contained in:
parent
842954f6a4
commit
3ed6736b2c
@ -190,7 +190,7 @@ def archspec_name(self) -> str:
|
||||
def cc(self) -> Optional[str]:
|
||||
assert self.spec.concrete, "cannot retrieve C compiler, spec is not concrete"
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes["compilers"].get("c", None)
|
||||
return self.spec.extra_attributes.get("compilers", {}).get("c", None)
|
||||
return self._cc_path()
|
||||
|
||||
def _cc_path(self) -> Optional[str]:
|
||||
@ -201,7 +201,7 @@ def _cc_path(self) -> Optional[str]:
|
||||
def cxx(self) -> Optional[str]:
|
||||
assert self.spec.concrete, "cannot retrieve C++ compiler, spec is not concrete"
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes["compilers"].get("cxx", None)
|
||||
return self.spec.extra_attributes.get("compilers", {}).get("cxx", None)
|
||||
return self._cxx_path()
|
||||
|
||||
def _cxx_path(self) -> Optional[str]:
|
||||
@ -212,7 +212,7 @@ def _cxx_path(self) -> Optional[str]:
|
||||
def fortran(self):
|
||||
assert self.spec.concrete, "cannot retrieve Fortran compiler, spec is not concrete"
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes["compilers"].get("fortran", None)
|
||||
return self.spec.extra_attributes.get("compilers", {}).get("fortran", None)
|
||||
return self._fortran_path()
|
||||
|
||||
def _fortran_path(self) -> Optional[str]:
|
||||
|
Loading…
Reference in New Issue
Block a user