summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2020-02-26 18:49:29 -0800
committerGitHub <noreply@github.com>2020-02-26 18:49:29 -0800
commited15adbb9e28913630079f39bc8a40f100a481dd (patch)
treec0f95f99bc5b545c770b5b75557ace97b30fc0bb /lib
parentebd248b27e47370bb597619c11488e5b2367a1c9 (diff)
downloadspack-ed15adbb9e28913630079f39bc8a40f100a481dd.tar.gz
spack-ed15adbb9e28913630079f39bc8a40f100a481dd.tar.bz2
spack-ed15adbb9e28913630079f39bc8a40f100a481dd.tar.xz
spack-ed15adbb9e28913630079f39bc8a40f100a481dd.zip
bugfix: Add dependents when initializing spec from yaml (#15220)
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents. - [x] populate dependents when loading from yaml
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py4
-rw-r--r--lib/spack/spack/test/concretize_preferences.py24
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 4b6bd67b6d..1493f0c973 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1919,9 +1919,7 @@ class Spec(object):
yaml_deps = node[name]['dependencies']
for dname, dhash, dtypes in Spec.read_yaml_dep_specs(yaml_deps):
- # Fill in dependencies by looking them up by name in deps dict
- deps[name]._dependencies[dname] = DependencySpec(
- deps[name], deps[dname], dtypes)
+ deps[name]._add_dependency(deps[dname], dtypes)
return spec
diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py
index 0d0d870506..81b5360869 100644
--- a/lib/spack/spack/test/concretize_preferences.py
+++ b/lib/spack/spack/test/concretize_preferences.py
@@ -15,15 +15,15 @@ from spack.version import Version
@pytest.fixture()
-def concretize_scope(config, tmpdir):
+def concretize_scope(mutable_config, tmpdir):
"""Adds a scope for concretization preferences"""
tmpdir.ensure_dir('concretize')
- config.push_scope(
+ mutable_config.push_scope(
ConfigScope('concretize', str(tmpdir.join('concretize'))))
yield
- config.pop_scope()
+ mutable_config.pop_scope()
spack.repo.path._provider_index = None
@@ -84,16 +84,24 @@ class TestConcretizePreferences(object):
'mpileaks', debug=True, opt=True, shared=False, static=False
)
- def test_preferred_compilers(self, mutable_mock_repo):
+ def test_preferred_compilers(self):
"""Test preferred compilers are applied correctly
"""
- update_packages('mpileaks', 'compiler', ['clang@3.3'])
+ # Need to make sure the test uses an available compiler
+ compiler_list = spack.compilers.all_compiler_specs()
+ assert compiler_list
+
+ # Try the first available compiler
+ compiler = str(compiler_list[0])
+ update_packages('mpileaks', 'compiler', [compiler])
spec = concretize('mpileaks')
- assert spec.compiler == spack.spec.CompilerSpec('clang@3.3')
+ assert spec.compiler == spack.spec.CompilerSpec(compiler)
- update_packages('mpileaks', 'compiler', ['gcc@4.5.0'])
+ # Try the last available compiler
+ compiler = str(compiler_list[-1])
+ update_packages('mpileaks', 'compiler', [compiler])
spec = concretize('mpileaks')
- assert spec.compiler == spack.spec.CompilerSpec('gcc@4.5.0')
+ assert spec.compiler == spack.spec.CompilerSpec(compiler)
def test_preferred_target(self, mutable_mock_repo):
"""Test preferred compilers are applied correctly