Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ut003460 committed Jul 11, 2023
1 parent 40b75f1 commit 366f783
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions avocado/utils/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,21 @@ def get_version():
"powerpc": rb"revision\s+:\s+(\S+)",
"s390": rb".*machine\s=\s(\d+)",
}

cpu_info = _get_info()
arch = get_arch()
try:
version_pattern[arch]
except KeyError as Err:
LOG.warning("No pattern string for arch: %s\n Error: %s", arch, Err)
return None

pattern = version_pattern.get(arch)

if not pattern:
LOG.warning("No pattern string for arch: %s", arch)
return ""

for line in cpu_info:
version_out = re.findall(version_pattern[arch], line)
version_out = re.findall(pattern, line)
if version_out:
return version_out[0].decode("utf-8")

return ""


Expand Down

0 comments on commit 366f783

Please sign in to comment.