mirror of https://github.com/ARMmbed/mbed-os.git
Search all stdout for version regex; check > 1 matches
parent
2aea6c39f7
commit
1a9474e4d9
|
@ -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("^Product: ARM Compiler (\d+.\d+)")
|
||||
ARMCC_VERSION_RE = re.compile("Product: ARM Compiler (\d+.\d+)")
|
||||
|
||||
@staticmethod
|
||||
def check_executable():
|
||||
|
@ -98,17 +98,16 @@ class ARM(mbedToolchain):
|
|||
stdout, _, retcode = run_cmd([self.cc[0], "--vsn"], redirect=True)
|
||||
msg = None
|
||||
min_ver, max_ver = self.ARMCC_RANGE
|
||||
first_line = stdout.splitlines()[0]
|
||||
match = self.ARMCC_VERSION_RE.match(first_line)
|
||||
if match:
|
||||
found_version = LooseVersion(match.group(1))
|
||||
if found_version < min_ver or found_version > max_ver:
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
"expected >= {} < {}"
|
||||
.format(found_version, min_ver, max_ver))
|
||||
else:
|
||||
match = self.ARMCC_VERSION_RE.search(stdout)
|
||||
found_version = LooseVersion(match.group(0)) if match else None
|
||||
min_ver, max_ver = self.ARM_RANGE
|
||||
if found_version and (found_version < min_ver or found_version >= max_ver):
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
"expected version >= {} and < {}"
|
||||
.format(found_version, min_ver, max_ver))
|
||||
elif len(match.groups()) != 1:
|
||||
msg = ("Compiler version mismatch: Could not detect version; "
|
||||
"expected >= {} < {}"
|
||||
"expected version >= {} and < {}"
|
||||
.format(min_ver, max_ver))
|
||||
|
||||
if msg:
|
||||
|
|
|
@ -114,18 +114,15 @@ class GCC(mbedToolchain):
|
|||
|
||||
def version_check(self):
|
||||
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
|
||||
found_version = None
|
||||
for line in stdout.splitlines():
|
||||
for word in line.split():
|
||||
match = self.GCC_VERSION_RE.match(word)
|
||||
if match:
|
||||
found_version = LooseVersion(match.group(0))
|
||||
msg = None
|
||||
match = self.GCC_VERSION_RE.search(stdout)
|
||||
found_version = LooseVersion(match.group(0)) 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 {}; "
|
||||
"expected version >= {} and < {}"
|
||||
.format(found_version, min_ver, max_ver))
|
||||
elif not found_version:
|
||||
elif len(match.groups()) != 1:
|
||||
msg = ("Compiler version mismatch: Could not detect version; "
|
||||
"expected version >= {} and < {}"
|
||||
.format(min_ver, max_ver))
|
||||
|
|
|
@ -97,16 +97,13 @@ class IAR(mbedToolchain):
|
|||
|
||||
def version_check(self):
|
||||
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
|
||||
found_version = None
|
||||
for line in stdout.splitlines():
|
||||
match = self.IAR_VERSION_RE.match(line)
|
||||
if match:
|
||||
found_version = match.group(1)
|
||||
msg = None
|
||||
match = self.IAR_VERSION_RE.search(stdout)
|
||||
found_version = match.group(1) 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)
|
||||
elif not found_version:
|
||||
elif len(match.groups()) != 1:
|
||||
msg = ("Compiler version mismatch: Could Not detect compiler "
|
||||
"version; expected {}".format(self.IAR_VERSION))
|
||||
if msg:
|
||||
|
|
Loading…
Reference in New Issue