diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-04 20:30:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 20:30:17 +0100 |
commit | fadcb75e482fe70f0100a7d7286146a1bb33c266 (patch) | |
tree | e75f82c0bcc4255e0683a3eff89d99c9d3230102 /methods.py | |
parent | 080b5df6256a368fcd767aec96dd2200194542c8 (diff) | |
parent | df7ecfc4a7f8403144be2aa49bb47f9ead25926b (diff) |
Merge pull request #36791 from akien-mga/scons-expand-cxx
SCons: Expand env variables to check compiler version
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/methods.py b/methods.py index 3f03e6bbd2..28c6d0c097 100644 --- a/methods.py +++ b/methods.py @@ -1,5 +1,4 @@ import os -import os.path import re import glob import subprocess @@ -564,7 +563,11 @@ def get_compiler_version(env): if not env.msvc: # Not using -dumpversion as some GCC distros only return major, and # Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803 - version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip()) + try: + version = decode_utf8(subprocess.check_output([env.subst(env['CXX']), '--version']).strip()) + except (subprocess.CalledProcessError, OSError): + print("Couldn't parse CXX environment variable to infer compiler version.") + return None else: # TODO: Implement for MSVC return None match = re.search('[0-9]+\.[0-9.]+', version) |