Revert "Honor cmake_prefix_paths property if available (#42569)" (#49237)

This reverts commit fe171a560b.
This commit is contained in:
Harmen Stoppels 2025-02-28 23:33:02 +01:00 committed by GitHub
parent d234df62d7
commit 8e7489bc17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

View File

@ -1234,10 +1234,6 @@ def _make_runnable(self, dep: spack.spec.Spec, env: EnvironmentModifications):
if os.path.isdir(bin_dir):
env.prepend_path("PATH", bin_dir)
for cp_dir in spack.build_systems.cmake.get_cmake_prefix_path(dep.package):
env.append_path("CMAKE_PREFIX_PATH", cp_dir)
env.prune_duplicate_paths("CMAKE_PREFIX_PATH")
def _setup_pkg_and_run(
serialized_pkg: "spack.subprocess_context.PackageInstallContext",

View File

@ -52,8 +52,7 @@ def test_load_shell(shell, set_command):
mpileaks_spec = spack.concretize.concretize_one("mpileaks")
# Ensure our reference variable is clean.
hello_world_paths = [os.path.normpath(p) for p in ("/hello", "/world")]
os.environ["CMAKE_PREFIX_PATH"] = os.pathsep.join(hello_world_paths)
os.environ["CMAKE_PREFIX_PATH"] = "/hello" + os.pathsep + "/world"
shell_out = load(shell, "mpileaks")
@ -70,7 +69,7 @@ def extract_value(output, variable):
paths_shell = extract_value(shell_out, "CMAKE_PREFIX_PATH")
# We should've prepended new paths, and keep old ones.
assert paths_shell[-2:] == hello_world_paths
assert paths_shell[-2:] == ["/hello", "/world"]
# All but the last two paths are added by spack load; lookup what packages they're from.
pkgs = [prefix_to_pkg(p) for p in paths_shell[:-2]]