summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-01 21:29:13 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-01 21:32:48 +0900
commit98930371593e39d9f4e5e07092019d6b97d1df45 (patch)
treee67c5e4e352e15f2b1b5aef27d4a91eba0ed39ae
parente65db4ae0e44ed82fbae5f680872412b34c89b8f (diff)
downloadbuildstream-98930371593e39d9f4e5e07092019d6b97d1df45.tar.gz
element.py: Removed _direct_deps() API
This API comes from a time when Element.dependencies() did not have a `recurse` keyword argument (as we did not expect to require that functionality to be public). Since the same can be accomplished with Element.dependencies(... recurse=False), it's better to just remove this old private API (which was actually broken and recently fixed with commit b194179d422b65ce8eaa599901b0362840584adb). NOTE: Tried this change on a pipeline with > 500 elements, and the reported cache keys are the same using Element.dependencies() as they were with the older Element._direct_deps() API.
-rw-r--r--buildstream/element.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index b987bc03e..35edba1b9 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -571,26 +571,6 @@ class Element(Plugin):
if scope != Scope.BUILD:
self.__runtime_dependencies.append(dependency)
- # _direct_deps():
- #
- # Generator function for the element's direct dependencies
- #
- # Note this is not recursive like the public element.dependencies().
- #
- def _direct_deps(self, scope):
- if scope == Scope.RUN:
- for element in self.__runtime_dependencies:
- yield element
- elif scope == Scope.BUILD:
- for element in self.__build_dependencies:
- yield element
- else:
- for element in self.__runtime_dependencies:
- yield element
- for element in self.__build_dependencies:
- if element not in self.__runtime_dependencies:
- yield element
-
# _consistency():
#
# Args:
@@ -711,7 +691,9 @@ class Element(Plugin):
if self.__cache_key is None:
# No cache keys for dependencies which have no cache keys
- dependencies = [e._get_cache_key() for e in self._direct_deps(Scope.BUILD)]
+ dependencies = [
+ e._get_cache_key() for e in self.dependencies(Scope.BUILD, recurse=False)
+ ]
for dep in dependencies:
if dep is None:
return None