You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:42:13 UTC
[buildstream] 01/01: _pipeline.py: Remove DummyElement hack
This is an automated email from the ASF dual-hosted git repository.
root pushed a commit to branch remove_dummy_dependency
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 16eac0ccfc879fc3068a6639d439a5a215d11e33
Author: Tristan Maat <tr...@codethink.co.uk>
AuthorDate: Wed Nov 8 15:18:02 2017 +0000
_pipeline.py: Remove DummyElement hack
---
buildstream/_pipeline.py | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index febadbc..f817f48 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