From d8fc38a467126454bb1c2c9e6e341667a9173963 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Fri, 4 Jun 2021 01:13:14 -0700 Subject: bugfix: modules relative to view use top-level view root, not implementation root (#24124) --- lib/spack/spack/modules/common.py | 2 +- lib/spack/spack/test/cmd/env.py | 4 ++-- lib/spack/spack/test/modules/lmod.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index 1e5f261578..ffd170226d 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -698,7 +698,7 @@ class BaseContext(tengine.Context): use_view = ev.default_view_name env = ev.get_env({}, 'post_env_write_hook', required=True) - view = env.views[use_view].view() + view = env.views[use_view] spec.prefix = view.get_projection_for_spec(spec) diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index 002bd14c0f..5aa30a9455 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -2504,7 +2504,7 @@ spack: install() spec = e.specs_by_hash[e.concretized_order[0]] - view_prefix = e.default_view.view().get_projection_for_spec(spec) + view_prefix = e.default_view.get_projection_for_spec(spec) modules_glob = '%s/modules/**/*' % e.path modules = glob.glob(modules_glob) assert len(modules) == 1 @@ -2539,7 +2539,7 @@ spack: install() spec = e.specs_by_hash[e.concretized_order[0]] - view_prefix = e.default_view.view().get_projection_for_spec(spec) + view_prefix = e.default_view.get_projection_for_spec(spec) modules_glob = '%s/modules/**/*' % e.path modules = glob.glob(modules_glob) assert len(modules) == 1 diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py index 097aaf526f..049bddcd9a 100644 --- a/lib/spack/spack/test/modules/lmod.py +++ b/lib/spack/spack/test/modules/lmod.py @@ -346,7 +346,7 @@ class TestLmod(object): spec = spack.spec.Spec('cmake').concretized() content = modulefile_content('cmake') - expected = e.default_view.view().get_projection_for_spec(spec) + expected = e.default_view.get_projection_for_spec(spec) # Rather than parse all lines, ensure all prefixes in the content # point to the right one assert any(expected in line for line in content) -- cgit v1.2.3-70-g09d2