Spec.__contains__: traverse only lin/run + direct build
This commit is contained in:
parent
5ff86017cb
commit
57e42f6a6b
@ -225,7 +225,7 @@ def provides(self):
|
||||
# All the other tokens in the hierarchy must be virtual dependencies
|
||||
for x in self.hierarchy_tokens:
|
||||
if self.spec.package.provides(x):
|
||||
provides[x] = self.spec[x]
|
||||
provides[x] = self.spec
|
||||
return provides
|
||||
|
||||
@property
|
||||
|
@ -3677,16 +3677,10 @@ def __getitem__(self, name: str):
|
||||
self.edges_to_dependencies(depflag=dt.BUILD | dt.TEST),
|
||||
)
|
||||
|
||||
# Consider runtime dependencies and direct build/test deps before transitive dependencies,
|
||||
# and prefer matches closest to the root.
|
||||
# Consider runtime dependencies and direct build/test deps only
|
||||
try:
|
||||
child: Spec = next(
|
||||
e.spec
|
||||
for e in itertools.chain(
|
||||
(e for e in order() if e.spec.name == name or name in e.virtuals),
|
||||
# for historical reasons
|
||||
(e for e in order() if e.spec.concrete and e.spec.package.provides(name)),
|
||||
)
|
||||
e.spec for e in order() if e.spec.name == name or name in e.virtuals
|
||||
)
|
||||
except StopIteration:
|
||||
raise KeyError(f"No spec with name {name} in {self}")
|
||||
|
Loading…
Reference in New Issue
Block a user