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.
This commit is contained in:

committed by
Todd Gamblin

parent
b14f18acda
commit
95a48b27ec
@@ -43,7 +43,7 @@ def flip(self):
|
||||
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 @@ def setup_environment(self, spack_env, run_env):
|
||||
"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.")
|
||||
|
Reference in New Issue
Block a user