cray compilers: fix bug with verifying cray compilers (#17303)

* fix bug with verifying cray compilers
This commit is contained in:
Greg Becker 2020-06-29 20:26:46 -05:00 committed by GitHub
parent d71fdc9719
commit b52390dacc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,11 +297,21 @@ def verify_executables(self):
Raises a CompilerAccessError if any of the non-null paths for the
compiler are not accessible.
"""
missing = [cmp for cmp in (self.cc, self.cxx, self.f77, self.fc)
if cmp and not (os.path.isfile(cmp) and
os.access(cmp, os.X_OK))]
if missing:
raise CompilerAccessError(self, missing)
def accessible_exe(exe):
# compilers may contain executable names (on Cray or user edited)
if not os.path.isabs(exe):
exe = spack.util.executable.which_string(exe)
if not exe:
return False
return os.path.isfile(exe) and os.access(exe, os.X_OK)
# setup environment before verifying in case we have executable names
# instead of absolute paths
with self._compiler_environment():
missing = [cmp for cmp in (self.cc, self.cxx, self.f77, self.fc)
if cmp and not accessible_exe(cmp)]
if missing:
raise CompilerAccessError(self, missing)
@property
def version(self):