diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2017-10-13 17:20:23 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-10-13 19:46:57 -0700 |
commit | afc99ca51699234ee3353013dba8f92cb1d28e2f (patch) | |
tree | 83fba1d1c51efba934341bf89f1d2ff2d22fbfe7 /lib | |
parent | 3f091fb6db627e3e780b27757dc8edfec117cb38 (diff) | |
download | spack-afc99ca51699234ee3353013dba8f92cb1d28e2f.tar.gz spack-afc99ca51699234ee3353013dba8f92cb1d28e2f.tar.bz2 spack-afc99ca51699234ee3353013dba8f92cb1d28e2f.tar.xz spack-afc99ca51699234ee3353013dba8f92cb1d28e2f.zip |
Remove single-root assertion from Spec.root
- Assertion would search for root through all possible paths.
- It's also really slow.
- This isn't needed anymore. We're pretty good at ensuring single-rooted
DAGs, and this assertion has never been thrown.
- This shaves another 6 seconds off r-rminer concretization
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/concretize.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index af3f3a3b18..bcbe1b74b8 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -113,7 +113,9 @@ class DefaultConcretizer(object): # Find the nearest spec in the dag that has a compiler. We'll # use that spec to calibrate compiler compatibility. - abi_exemplar = find_spec(spec, lambda x: x.compiler, spec.root) + abi_exemplar = find_spec(spec, lambda x: x.compiler) + if abi_exemplar is None: + abi_exemplar = spec.root # Sort candidates from most to least compatibility. # We reverse because True > False. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index ed204deb9e..70a27fb951 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -1178,20 +1178,13 @@ class Spec(object): @property def root(self): """Follow dependent links and find the root of this spec's DAG. - In spack specs, there should be a single root (the package being - installed). This will throw an assertion error if that is not - the case. + + Spack specs have a single root (the package being installed). """ if not self._dependents: return self - # If the spec has multiple dependents, ensure that they all - # lead to the same place. Spack shouldn't deal with any DAGs - # with multiple roots, so something's wrong if we find one. - depiter = iter(self._dependents.values()) - first_root = next(depiter).parent.root - assert(all(first_root is d.parent.root for d in depiter)) - return first_root + return next(iter(self._dependents.values())).parent.root @property def package(self): |