Slurm: extend spack external find support (#47740)

* Slurm: extend spack external find support

On Debian srun/salloc --version returns 'slurm-wlm VERSION'. Check for both strings and return the first match.

* non-capturing group for slurm determine_version

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>

* slurm: add detection test

---------

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>
This commit is contained in:
Martin Lang 2025-03-14 04:35:49 +01:00 committed by GitHub
parent c0cbbcfa0a
commit 6ba7aa325b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,23 @@
paths:
- layout:
# SLES:
- executables:
- "bin/srun"
script: |
echo "slurm 22.05.8"
- executables:
- "bin/salloc"
script: |
echo "slurm 22.05.8"
# Debian:
- executables:
- "bin/srun"
script: |
echo "slurm-wlm 22.05.8"
- executables:
- "bin/salloc"
script: |
echo "slurm-wlm 22.05.8"
platforms: ["linux"]
results:
- spec: "slurm@22.05.8"

View File

@ -178,7 +178,7 @@ class Slurm(AutotoolsPackage):
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str).rstrip()
match = re.search(r"slurm\s*([0-9.]+)", output)
match = re.search(r"slurm(?:-wlm)?\s*([0-9.]+)", output)
return match.group(1) if match else None
def flag_handler(self, name, flags):