summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-09-06 15:07:11 +0200
committeralalazo <massimiliano.culpo@googlemail.com>2016-09-06 15:07:11 +0200
commitfc576a40d66ad6f83fd512ce053cc83e011a1e30 (patch)
tree9bfff53a390b3a207d90b7c53b8a15037443b5f1 /lib
parent16c5403ab3ca35dfa6d715ce2c5434c65de81c17 (diff)
downloadspack-fc576a40d66ad6f83fd512ce053cc83e011a1e30.tar.gz
spack-fc576a40d66ad6f83fd512ce053cc83e011a1e30.tar.bz2
spack-fc576a40d66ad6f83fd512ce053cc83e011a1e30.tar.xz
spack-fc576a40d66ad6f83fd512ce053cc83e011a1e30.zip
modules : ('build',) type dependencies are not accounted when autoloading
fixes #1681
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/modules.py3
-rw-r--r--lib/spack/spack/test/modules.py22
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 70c3c35d8c..3db08a6e90 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -120,7 +120,7 @@ def dependencies(spec, request='all'):
return []
if request == 'direct':
- return spec.dependencies()
+ return spec.dependencies(deptype=('link', 'run'))
# FIXME : during module file creation nodes seem to be visited multiple
# FIXME : times even if cover='nodes' is given. This work around permits
@@ -133,6 +133,7 @@ def dependencies(spec, request='all'):
spec.traverse(order='post',
depth=True,
cover='nodes',
+ deptype=('link', 'run'),
root=False),
reverse=True)]
return [xx for ii, xx in l if not (xx in seen or seen_add(xx))]
diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py
index 5e280d8e43..55b771fc79 100644
--- a/lib/spack/spack/test/modules.py
+++ b/lib/spack/spack/test/modules.py
@@ -229,6 +229,28 @@ class TclTests(MockPackagesTest):
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5)
self.assertEqual(len([x for x in content if 'module load ' in x]), 5)
+ # dtbuild1 has
+ # - 1 ('run',) dependency
+ # - 1 ('build','link') dependency
+ # - 1 ('build',) dependency
+ # Just make sure the 'build' dependency is not there
+ spack.modules.CONFIGURATION = configuration_autoload_direct
+ spec = spack.spec.Spec('dtbuild1')
+ content = self.get_modulefile_content(spec)
+ self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2)
+ self.assertEqual(len([x for x in content if 'module load ' in x]), 2)
+
+ # dtbuild1 has
+ # - 1 ('run',) dependency
+ # - 1 ('build','link') dependency
+ # - 1 ('build',) dependency
+ # Just make sure the 'build' dependency is not there
+ spack.modules.CONFIGURATION = configuration_autoload_all
+ spec = spack.spec.Spec('dtbuild1')
+ content = self.get_modulefile_content(spec)
+ self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2)
+ self.assertEqual(len([x for x in content if 'module load ' in x]), 2)
+
def test_prerequisites(self):
spack.modules.CONFIGURATION = configuration_prerequisites_direct
spec = spack.spec.Spec('mpileaks arch=x86-linux')