summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compiler.py11
-rw-r--r--lib/spack/spack/compilers/pgi.py1
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