From 95a48b27ec09b691d4107d48854126c045b03188 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Tue, 22 Oct 2019 23:27:40 -0700 Subject: env activation: use package defined env setup methods (#13249) This PR ensures that environment activation sets all environment variables set by the equivalent `module load` operations, except that the spec prefixes are "rebased" to the view associated with the environment. Currently, Spack blindly adds paths relative to the environment view root to the user environment on activation. Issue #12731 points out ways in which this behavior is insufficient. This PR changes that behavior to use the `setup_run_environment` logic for each package to augment the prefix inspections (as in Spack's modulefile generation logic) to ensure that all necessary variables are set to make use of the packages in the environment. See #12731 for details on the previous problems in behavior. This PR also updates the `ViewDescriptor` object in `spack.environment` to have a `__contains__` method. This allows for checks like `if spec in self.default_view`. The `__contains__` operator for `ViewDescriptor` objects checks whether the spec satisfies the filters of the View descriptor, not whether the spec is already linked into the underlying `FilesystemView` object. --- var/spack/repos/builtin.mock/packages/cmake-client/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/cmake-client/package.py b/var/spack/repos/builtin.mock/packages/cmake-client/package.py index e5cadb5d61..40e1c9f9ed 100644 --- a/var/spack/repos/builtin.mock/packages/cmake-client/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake-client/package.py @@ -43,7 +43,7 @@ class CmakeClient(CMakePackage): def do_not_execute(self): self.did_something = True - def setup_environment(self, spack_env, run_env): + def setup_build_environment(self, spack_env): spack_cc # Ensure spack module-scope variable is avaiabl check(from_cmake == "from_cmake", "setup_environment couldn't read global set by cmake.") @@ -52,7 +52,7 @@ class CmakeClient(CMakePackage): "link arg on dependency spec not readable from " "setup_environment.") - def setup_dependent_environment(self, spack_env, run_env, dspec): + def setup_dependent_build_environment(self, spack_env, dspec): spack_cc # Ensure spack module-scope variable is avaiable check(from_cmake == "from_cmake", "setup_dependent_environment couldn't read global set by cmake.") -- cgit v1.2.3-70-g09d2