diff options
author | Greg Becker <becker33@llnl.gov> | 2020-06-29 20:26:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 20:26:46 -0500 |
commit | b52390dacc14028f84878ebf068bdd95d5cd82e2 (patch) | |
tree | 63096c16a44e86d69761ab7a6aac5f15154ad9bb /lib | |
parent | d71fdc9719f716347bb4d61e26e00368466f3aa4 (diff) | |
download | spack-b52390dacc14028f84878ebf068bdd95d5cd82e2.tar.gz spack-b52390dacc14028f84878ebf068bdd95d5cd82e2.tar.bz2 spack-b52390dacc14028f84878ebf068bdd95d5cd82e2.tar.xz spack-b52390dacc14028f84878ebf068bdd95d5cd82e2.zip |
cray compilers: fix bug with verifying cray compilers (#17303)
* fix bug with verifying cray compilers
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/compiler.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 5dd3d60778..0982682081 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -297,11 +297,21 @@ class Compiler(object): 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): |