diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-13 17:01:45 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-18 11:37:59 -0800 |
commit | 4eb54b6358c5825d69558662d0ef1787e75a24ab (patch) | |
tree | 8cd72b214d050e31abd792eb785c2ba18f9d570c | |
parent | fa5e8aa87670fdd437a7a159d8dcb74187d46155 (diff) | |
download | spack-4eb54b6358c5825d69558662d0ef1787e75a24ab.tar.gz spack-4eb54b6358c5825d69558662d0ef1787e75a24ab.tar.bz2 spack-4eb54b6358c5825d69558662d0ef1787e75a24ab.tar.xz spack-4eb54b6358c5825d69558662d0ef1787e75a24ab.zip |
bugfix: `pgcc -V` returns 2 on power machines
`pgcc -V` was failing on power machines because it returns 2 (despite
correctly printing version information). On x86_64 machines the same
command returns 0 and doesn't cause an error.
- [x] Ignore return value of 2 for pgcc when doign a version check
-rw-r--r-- | lib/spack/spack/compiler.py | 11 | ||||
-rw-r--r-- | lib/spack/spack/compilers/pgi.py | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index f2b62dc3f9..1a6b33af0c 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -32,7 +32,7 @@ def _verify_executables(*paths): @llnl.util.lang.memoized -def get_compiler_version_output(compiler_path, version_arg): +def get_compiler_version_output(compiler_path, version_arg, ignore_errors=()): """Invokes the compiler at a given path passing a single version argument and returns the output. @@ -41,7 +41,8 @@ def get_compiler_version_output(compiler_path, version_arg): version_arg (str): the argument used to extract version information """ compiler = spack.util.executable.Executable(compiler_path) - output = compiler(version_arg, output=str, error=str) + output = compiler( + version_arg, output=str, error=str, ignore_errors=ignore_errors) return output @@ -199,6 +200,9 @@ class Compiler(object): #: Compiler argument that produces version information version_argument = '-dumpversion' + #: Return values to ignore when invoking the compiler to get its version + ignore_version_errors = () + #: Regex used to extract version from compiler's output version_regex = '(.*)' @@ -412,7 +416,8 @@ class Compiler(object): @classmethod def default_version(cls, cc): """Override just this to override all compiler version functions.""" - output = get_compiler_version_output(cc, cls.version_argument) + output = get_compiler_version_output( + cc, cls.version_argument, tuple(cls.ignore_version_errors)) return cls.extract_version_from_output(output) @classmethod diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index 90560f7c63..2798210bca 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -30,6 +30,7 @@ class Pgi(Compiler): PrgEnv_compiler = 'pgi' version_argument = '-V' + ignore_version_errors = [2] # `pgcc -V` on PowerPC annoyingly returns 2 version_regex = r'pg[^ ]* ([0-9.]+)-[0-9]+ (LLVM )?[^ ]+ target on ' @classmethod |