oneapi-compilers: allow detection of executables symlinked to prefix.bin (#49742)

* intel-oneapi-compilers: detect compilers when symlinked to prefix.bin

* update detection tests

--

Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
Greg Becker 2025-03-28 11:28:47 -07:00 committed by GitHub
parent 6f2019ece9
commit d5f5d48bb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 1 deletions

View File

@ -21,3 +21,25 @@ paths:
c: ".*/compiler/2021.2.0/linux/bin/icx"
cxx: ".*/compiler/2021.2.0/linux/bin/icpx"
fortran: ".*/compiler/2021.2.0/linux/bin/ifx"
- layout:
- executables:
- "bin/icx"
- "bin/icpx"
script: |
echo "Intel(R) oneAPI DPC++ Compiler 2021.2.0 (2021.2.0.20210317)"
echo "Target: x86_64-unknown-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /made/up/path",
- executables:
- "bin/ifx"
script: |
echo "ifx (IFORT) 2021.2.0 Beta 20201214"
echo "Copyright (C) 1985-2020 Intel Corporation. All rights reserved."
platforms: [linux]
results:
- spec: intel-oneapi-compilers@2021.2.0
extra_attributes:
compilers:
c: ".*/bin/icx"
cxx: ".*/bin/icpx"
fortran: ".*/bin/ifx"

View File

@ -639,7 +639,15 @@ def determine_variants(cls, exes, version_str):
dirs = ", ".join([str(x) for x in sorted(bin_dirs)])
raise RuntimeError(f"executables found in multiple dirs: {dirs}")
bin_dir = bin_dirs.pop()
prefix_parts = bin_dir.parts[: bin_dir.parts.index("compiler")]
# Some sites symlink the bindir to the top level of the prefix
if "compiler" in bin_dir.parts:
# Normal installation
prefix_parts = bin_dir.parts[: bin_dir.parts.index("compiler")]
else:
# Executables from top level bin dir as symlinks
prefix_parts = bin_dir.parts[:-1]
computed_prefix = pathlib.Path(*prefix_parts)
extra_attributes["prefix"] = str(computed_prefix)