diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 45353ec640..cabde7dc86 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -207,3 +207,8 @@ def setup_package(pkg): set_compiler_environment_variables(pkg) set_build_environment_variables(pkg) set_module_variables_for_package(pkg) + + # Allow dependencies to set up environment as well. + for dep_spec in pkg.spec.traverse(root=False): + dep_spec.package.setup_dependent_environment( + pkg.module, dep_spec, pkg.spec) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 6e319a1f87..b18d054990 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -829,11 +829,6 @@ def do_install(self, **kwargs): self.stage.chdir_to_source() build_env.setup_package(self) - # Allow dependencies to further set up the environment. - for dep_spec in self.spec.traverse(root=False): - dep_spec.package.setup_dependent_environment( - self.module, dep_spec, self.spec) - if fake_install: self.do_fake_install() else: