summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-04-05 16:10:04 +0200
committeralalazo <massimiliano.culpo@googlemail.com>2016-04-05 16:10:04 +0200
commitca7d7010076a520fa20f02ab0609bbc3e6216d2f (patch)
treeb0db6d49375c8763a4f7943959d1ea3cb74f4c67 /lib
parentc352249e305c00d951586bc8c19a13ceadaa1887 (diff)
downloadspack-ca7d7010076a520fa20f02ab0609bbc3e6216d2f.tar.gz
spack-ca7d7010076a520fa20f02ab0609bbc3e6216d2f.tar.bz2
spack-ca7d7010076a520fa20f02ab0609bbc3e6216d2f.tar.xz
spack-ca7d7010076a520fa20f02ab0609bbc3e6216d2f.zip
module file : all the dependencies can affect the run_time environment, not only extendees
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/modules.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 0d486f6430..04317f53b1 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -50,6 +50,7 @@ import llnl.util.tty as tty
import spack
import spack.config
from llnl.util.filesystem import join_path, mkdirp
+from spack.build_environment import parent_class_modules, set_module_variables_for_package
from spack.environment import *
__all__ = ['EnvModule', 'Dotkit', 'TclModule']
@@ -159,12 +160,25 @@ class EnvModule(object):
# installation prefix
env = inspect_path(self.spec.prefix)
- # Let the extendee modify their extensions before asking for
+ # Let the extendee/dependency modify their extensions/dependencies before asking for
# package-specific modifications
spack_env = EnvironmentModifications()
- for item in self.pkg.extendees:
+
+ def dependencies():
+ # FIXME : during module file creation nodes seem to be visited multiple times even if cover='nodes'
+ # FIXME : is given. This work around permits to get a unique list of spec anyhow.
+ # FIXME : Possibly we miss a merge step among nodes that refer to the same package.
+ l = [x for x in sorted(self.spec.traverse(order='post', depth=True, cover='nodes'),reverse=True)]
+ seen = set()
+ return [x for ii, x in l if not (x in seen or seen.add(x))]
+
+ for item in dependencies():
try:
- package = self.spec[item].package
+ package = self.spec[item.name].package
+ modules = parent_class_modules(package.__class__)
+ for mod in modules:
+ set_module_variables_for_package(package, mod)
+ set_module_variables_for_package(package, package.module)
package.setup_dependent_package(self.pkg.module, self.spec)
package.setup_dependent_environment(spack_env, env, self.spec)
except KeyError as e:
@@ -172,8 +186,8 @@ class EnvModule(object):
# eg: extends('python', when='+python')
tty.debug(str(e))
-
# Package-specific environment modifications
+ set_module_variables_for_package(self.pkg, self.pkg.module)
self.spec.package.setup_environment(spack_env, env)
# TODO : implement site-specific modifications and filters