diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-11-08 15:18:02 +0000 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-11-08 15:24:57 +0000 |
commit | 16eac0ccfc879fc3068a6639d439a5a215d11e33 (patch) | |
tree | a649e7f640f481c7e6b2c8c9bc6b3c16c0566153 | |
parent | 213d9072b684d2dff78d8b4f1c7cfa9d6335b0d0 (diff) | |
download | buildstream-remove_dummy_dependency.tar.gz |
_pipeline.py: Remove DummyElement hackremove_dummy_dependency
-rw-r--r-- | buildstream/_pipeline.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index febadbcc7..f817f48ad 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -25,6 +25,7 @@ import stat import shlex import shutil import tarfile +import itertools from operator import itemgetter from tempfile import TemporaryDirectory from pluginbase import PluginBase @@ -195,24 +196,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 |