diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-11-08 15:18:02 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2017-11-10 09:44:20 +0000 |
commit | 58ca697cc250c1862977a6c4c9bbf82e62317d02 (patch) | |
tree | 0d8f2668fa3c7dae8f9a07708e781dba6fb4c382 /buildstream/_pipeline.py | |
parent | 25f6bec66a742cf96e45ed4f2e16bbcde972174b (diff) | |
download | buildstream-58ca697cc250c1862977a6c4c9bbf82e62317d02.tar.gz |
Remove DummyElement hack
Diffstat (limited to 'buildstream/_pipeline.py')
-rw-r--r-- | buildstream/_pipeline.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index febadbcc7..9820880f6 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -195,24 +195,16 @@ class Pipeline(): # also iterate over sources. # def dependencies(self, scope, include_sources=False): - # Create a dummy element (can't use namedtuple because of the - # '__' prefix). - class DummyElement(object): - def __init__(self, build_dependencies, runtime_dependencies): - self.name = '' - self._Element__build_dependencies = build_dependencies - self._Element__runtime_dependencies = runtime_dependencies - dummy = DummyElement(self.targets, self.targets) - - for element in Element.dependencies(dummy, scope): - # We don't actually want to find the dummy element - if isinstance(element, DummyElement): - continue - - if include_sources: - for source in element.sources(): - yield source - yield element + # Keep track of 'visited' in this scope, so that all targets + # share the same context. + visited = {} + + for target in self.targets: + for element in target.dependencies(scope, visited=visited): + if include_sources: + for source in element.sources(): + yield source + yield element # Asserts that the pipeline is in a consistent state, that # is to say that all sources are consistent and can at least |