acts: ensure Python_EXECUTABLE uses ^python when +python (#38540)

By default, `find_package(Python)` searches from highest version to lowest version, identifying the highest version that satisfies the requirements. This means that `/usr/bin/python3.11` will be found before `$(spack location -i python)/bin/python3.10`, even when other packages have been built with the `python` in spack.

This ensures that the `python` dependency is explicitly the `python` version that is used.
This commit is contained in:
Wouter Deconinck 2023-06-26 04:31:48 -05:00 committed by GitHub
parent c560053c39
commit ce0b9ea8cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -391,4 +391,8 @@ def plugin_cmake_variant(plugin_name, spack_variant):
cxxstd = spec["root"].variants["cxxstd"].value
args.append("-DCMAKE_CXX_STANDARD={0}".format(cxxstd))
if "+python" in spec:
python = spec["python"].command.path
args.append("-DPython_EXECUTABLE={0}".format(python))
return args