Skip to content

Commit 344378e

Browse files
committed
Fix version parsing to allow linker category
1 parent b8e1114 commit 344378e

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Diff for: source/fab/tools/compiler.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ def parse_version_output(self, category: Category,
335335
'''
336336
Extract the numerical part from a GNU compiler's version output
337337
338-
:param name: the compiler's name
339338
:param category: the compiler's Category
340339
:param version_output: the full version output from the compiler
341340
:returns: the actual version as a string
@@ -404,7 +403,7 @@ def parse_version_output(self, category: Category,
404403
'''
405404
Extract the numerical part from an Intel compiler's version output
406405
407-
:param name: the compiler's name
406+
:param category: the compiler's Category
408407
:param version_output: the full version output from the compiler
409408
:returns: the actual version as a string
410409

Diff for: source/fab/tools/compiler_wrapper.py

+21-4
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,31 @@ def __init__(self, name: str, exec_name: str,
4141
suite=self._compiler.suite,
4242
mpi=mpi,
4343
availability_option=self._compiler.availability_option)
44-
# We need to have the right version to parse the version output
45-
# So we set this function based on the function that the
46-
# wrapped compiler uses:
47-
setattr(self, "parse_version_output", compiler.parse_version_output)
4844

4945
def __str__(self):
5046
return f"{type(self).__name__}({self._compiler.name})"
5147

48+
# We need to have the right version to parse the version output
49+
# So we set this function based on the function that the
50+
# wrapped compiler uses:
51+
def parse_version_output(self, _: Category, version_output: str) -> str:
52+
"""
53+
Extract the numerical part from a GNU compiler's version output
54+
55+
Overridden to use the wrapped compiler's version of the function, and
56+
pass in the wrapped compiler's category, since the category of this
57+
wrapper might be different.
58+
59+
:param category: the compiler's Category
60+
:param version_output: the full version output from the compiler
61+
:returns: the actual version as a string
62+
63+
:raises RuntimeError: if the output is not in an expected format.
64+
"""
65+
66+
return self.compiler.parse_version_output(
67+
self.compiler.category, version_output)
68+
5269
def get_version(self) -> Tuple[int, ...]:
5370
"""
5471
:returns: a tuple of at least 2 integers, representing the version

0 commit comments

Comments
 (0)