spack.modules.commmon: pass spec to SetupContext (#40886)

Currently module globals aren't set before running
`setup_[dependent_]run_environment` to compute environment modifications
for module files. This commit fixes that.
This commit is contained in:
Harmen Stoppels 2023-11-04 21:42:47 +01:00 committed by GitHub
parent f51dad976e
commit 6593d22c4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -731,7 +731,9 @@ def environment_modifications(self):
# for that to work, globals have to be set on the package modules, and the # for that to work, globals have to be set on the package modules, and the
# whole chain of setup_dependent_package has to be followed from leaf to spec. # whole chain of setup_dependent_package has to be followed from leaf to spec.
# So: just run it here, but don't collect env mods. # So: just run it here, but don't collect env mods.
spack.build_environment.SetupContext(context=Context.RUN).set_all_package_py_globals() spack.build_environment.SetupContext(
spec, context=Context.RUN
).set_all_package_py_globals()
# Then run setup_dependent_run_environment before setup_run_environment. # Then run setup_dependent_run_environment before setup_run_environment.
for dep in spec.dependencies(deptype=("link", "run")): for dep in spec.dependencies(deptype=("link", "run")):