mirror of https://github.com/ARMmbed/mbed-os.git
Correct string usage in version checking
parent
0d52fc3a20
commit
f9c25ee769
|
@ -41,7 +41,7 @@ class ARM(mbedToolchain):
|
|||
SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4",
|
||||
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A9"]
|
||||
ARMCC_RANGE = (LooseVersion("5.06"), LooseVersion("5.07"))
|
||||
ARMCC_VERSION_RE = re.compile("Component: ARM Compiler (\d+\.\d+)")
|
||||
ARMCC_VERSION_RE = re.compile(b"Component: ARM Compiler (\d+\.\d+)")
|
||||
|
||||
@staticmethod
|
||||
def check_executable():
|
||||
|
@ -99,7 +99,7 @@ class ARM(mbedToolchain):
|
|||
msg = None
|
||||
min_ver, max_ver = self.ARMCC_RANGE
|
||||
match = self.ARMCC_VERSION_RE.search(stdout)
|
||||
found_version = LooseVersion(match.group(1)) if match else None
|
||||
found_version = LooseVersion(match.group(1).decode("utf-8")) if match else None
|
||||
min_ver, max_ver = self.ARMCC_RANGE
|
||||
if found_version and (found_version < min_ver or found_version >= max_ver):
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
|
|
|
@ -31,7 +31,7 @@ class GCC(mbedToolchain):
|
|||
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
|
||||
|
||||
GCC_RANGE = (LooseVersion("6.0.0"), LooseVersion("7.0.0"))
|
||||
GCC_VERSION_RE = re.compile("\d+\.\d+\.\d+")
|
||||
GCC_VERSION_RE = re.compile(b"\d+\.\d+\.\d+")
|
||||
|
||||
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
||||
build_dir=None):
|
||||
|
@ -116,7 +116,7 @@ class GCC(mbedToolchain):
|
|||
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
|
||||
msg = None
|
||||
match = self.GCC_VERSION_RE.search(stdout)
|
||||
found_version = LooseVersion(match.group(0)) if match else None
|
||||
found_version = LooseVersion(match.group(0).decode('utf-8')) if match else None
|
||||
min_ver, max_ver = self.GCC_RANGE
|
||||
if found_version and (found_version < min_ver or found_version >= max_ver):
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
|
|
|
@ -30,7 +30,7 @@ class IAR(mbedToolchain):
|
|||
|
||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error|Fatal error)(?P<message>.+)')
|
||||
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
|
||||
IAR_VERSION_RE = re.compile("IAR ANSI C/C\+\+ Compiler V(\d+\.\d+)")
|
||||
IAR_VERSION_RE = re.compile(b"IAR ANSI C/C\+\+ Compiler V(\d+\.\d+)")
|
||||
IAR_VERSION = LooseVersion("7.80")
|
||||
|
||||
@staticmethod
|
||||
|
@ -99,7 +99,7 @@ class IAR(mbedToolchain):
|
|||
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
|
||||
msg = None
|
||||
match = self.IAR_VERSION_RE.search(stdout)
|
||||
found_version = match.group(1) if match else None
|
||||
found_version = match.group(1).decode("utf-8") if match else None
|
||||
if found_version and LooseVersion(found_version) != self.IAR_VERSION:
|
||||
msg = "Compiler version mismatch: Have {}; expected {}".format(
|
||||
found_version, self.IAR_VERSION)
|
||||
|
|
Loading…
Reference in New Issue