From 179663523acd3f417f7fdefb83ec31244245d748 Mon Sep 17 00:00:00 2001 From: paugier Date: Mon, 2 Sep 2024 17:46:08 +0200 Subject: [PATCH] MPI detection: get version from old IntelMPI wrappers --- mesonbuild/dependencies/mpi.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mesonbuild/dependencies/mpi.py b/mesonbuild/dependencies/mpi.py index 14c2560cc..246b31233 100644 --- a/mesonbuild/dependencies/mpi.py +++ b/mesonbuild/dependencies/mpi.py @@ -176,18 +176,23 @@ class MPIConfigToolDependency(ConfigToolDependency): # --version is not the same as -v p, out = Popen_safe(tool + ['-v'])[:2] valid = p.returncode == returncode - out = out.split("\n", maxsplit=1)[0] + first_line = out.split('\n', maxsplit=1)[0] # cases like "mpicc for MPICH version 4.2.2" - v = re.search(r'\d+.\d+.\d+', out) + v = re.search(r'\d+.\d+.\d+', first_line) if v: return valid, v.group(0) # cases like "mpigcc for Intel(R) MPI library 2021.13" - v = re.search(r'\d+.\d+', out) + v = re.search(r'\d+.\d+', first_line) if v: return valid, v.group(0) + # cases like "mpiifort for the Intel(R) MPI Library 2019 Update 9 for Linux*" + v = re.search(r'(\d{4}) Update (\d)', first_line) + if v: + return valid, f'{v.group(1)}.{v.group(2)}' + return valid, None