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
This commit is contained in:
parent
fa5e8aa876
commit
4eb54b6358
2 changed files with 9 additions and 3 deletions
|
@ -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 @@ def c11_flag(self):
|
|||
@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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue