Improve compiler version extraction

This commit is contained in:
MmAaXx500 2021-05-27 19:42:30 +02:00
parent ff648e2504
commit c759b7b235
2 changed files with 42 additions and 7 deletions

View file

@ -787,9 +787,18 @@ def get_compiler_version(env):
return None
else: # TODO: Implement for MSVC
return None
match = re.search("[0-9]+\.[0-9.]+", version)
match = re.search(
"(?:(?<=version )|(?<=\) )|(?<=^))"
"(?P<major>\d+)"
"(?:\.(?P<minor>\d*))?"
"(?:\.(?P<patch>\d*))?"
"(?:-(?P<metadata1>[0-9a-zA-Z-]*))?"
"(?:\+(?P<metadata2>[0-9a-zA-Z-]*))?"
"(?: (?P<date>[0-9]{8}|[0-9]{6})(?![0-9a-zA-Z]))?",
version,
)
if match is not None:
return list(map(int, match.group().split(".")))
return match.groupdict()
else:
return None