From 02307cf7ceabdf16d02f1afd0f38c50bd7501080 Mon Sep 17 00:00:00 2001 From: Alfredo Adolfo Gimenez Date: Wed, 21 Sep 2016 00:52:09 -0700 Subject: [PATCH] Set JAVA_HOME on module load and on dependent installs. (#1716) * Set JAVA_HOME on module load and on dependent installs. * Include environment setup from dependencies in dependee module (#1714) --- lib/spack/spack/modules.py | 1 + var/spack/repos/builtin/packages/jdk/package.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py index d75bfbac45..aa3ad5843f 100644 --- a/lib/spack/spack/modules.py +++ b/lib/spack/spack/modules.py @@ -392,6 +392,7 @@ def write(self, overwrite=False): for mod in modules: set_module_variables_for_package(package, mod) set_module_variables_for_package(package, package.module) + package.setup_environment(spack_env, env) package.setup_dependent_package(self.pkg.module, self.spec) package.setup_dependent_environment(spack_env, env, self.spec) diff --git a/var/spack/repos/builtin/packages/jdk/package.py b/var/spack/repos/builtin/packages/jdk/package.py index 63bf6514cb..bab0920434 100644 --- a/var/spack/repos/builtin/packages/jdk/package.py +++ b/var/spack/repos/builtin/packages/jdk/package.py @@ -68,3 +68,9 @@ def do_fetch(self, mirror_only=False): def install(self, spec, prefix): distutils.dir_util.copy_tree(".", prefix) + + def setup_environment(self, spack_env, run_env): + run_env.set('JAVA_HOME', self.spec.prefix) + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + spack_env.set('JAVA_HOME', self.spec.prefix)