Merge pull request #36791 from akien-mga/scons-expand-cxx

SCons: Expand env variables to check compiler version
This commit is contained in:
Rémi Verschelde 2020-03-04 20:30:17 +01:00 committed by GitHub
commit fadcb75e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,4 @@
import os import os
import os.path
import re import re
import glob import glob
import subprocess import subprocess
@ -564,7 +563,11 @@ def get_compiler_version(env):
if not env.msvc: if not env.msvc:
# Not using -dumpversion as some GCC distros only return major, and # Not using -dumpversion as some GCC distros only return major, and
# Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803 # 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 else: # TODO: Implement for MSVC
return None return None
match = re.search('[0-9]+\.[0-9.]+', version) match = re.search('[0-9]+\.[0-9.]+', version)

View File

@ -1,7 +1,7 @@
import os import os
import platform import platform
import sys import sys
from methods import get_compiler_version, using_gcc, using_clang from methods import using_gcc, using_clang
def is_active(): def is_active():