summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/arm.py16
-rw-r--r--lib/spack/spack/test/compilers.py8
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
index ffce1e2b01..ca17ff42e8 100644
--- a/lib/spack/spack/compilers/arm.py
+++ b/lib/spack/spack/compilers/arm.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.compiler
+import re
class Arm(spack.compiler.Compiler):
@@ -35,7 +36,20 @@ class Arm(spack.compiler.Compiler):
# InstalledDir:
# /opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin
version_argument = '--version'
- version_regex = r'Arm C\/C\+\+\/Fortran Compiler version ([^ )]+)'
+ version_regex = r'Arm C\/C\+\+\/Fortran Compiler version ([\d\.]+) '\
+ r'\(build number (\d+)\) '
+
+ @classmethod
+ def extract_version_from_output(cls, output):
+ """Extracts the version from compiler's output."""
+ match = re.search(cls.version_regex, output)
+ temp = 'unknown'
+ if match:
+ if match.group(1).count('.') == 1:
+ temp = match.group(1) + ".0." + match.group(2)
+ else:
+ temp = match.group(1) + "." + match.group(2)
+ return temp
@classmethod
def verbose_flag(cls):
diff --git a/lib/spack/spack/test/compilers.py b/lib/spack/spack/test/compilers.py
index 51eedd748f..13e3d9e695 100644
--- a/lib/spack/spack/test/compilers.py
+++ b/lib/spack/spack/test/compilers.py
@@ -369,7 +369,13 @@ def test_clang_version_detection(version_str, expected_version):
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
- '19.0')
+ '19.0.0.73'),
+ ('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n' # NOQA
+ 'Target: aarch64--linux-gnu\n'
+ 'Thread model: posix\n'
+ 'InstalledDir:\n'
+ '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
+ '19.3.1.75')
])
def test_arm_version_detection(version_str, expected_version):
version = spack.compilers.arm.Arm.extract_version_from_output(version_str)