summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-13 19:18:04 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-06-25 21:08:50 +0100
commit016c8a6c5c35407d5d6498f982ec851076ab78c0 (patch)
treedfa685c8340205a569a1cd5545baccfd27682941
parentf72971a0776c090e02f18d4c20f87b5c448b8fb0 (diff)
downloadbuildstream-016c8a6c5c35407d5d6498f982ec851076ab78c0.tar.gz
element: remove 'node_subst_list_element'
This method is unused and can be easily reimplemented with the new Node API by looping over nodes.
-rw-r--r--src/buildstream/element.py41
-rw-r--r--src/buildstream/plugin.py3
2 files changed, 1 insertions, 43 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index fc51ba940..8990b03a2 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -549,47 +549,6 @@ class Element(Plugin):
raise LoadError(e.reason, '{}: {}'.format(provenance, e), detail=e.detail) from e
return ret
- def node_subst_list_element(self, node, member_name, indices):
- """Fetch the value of a list element from a node member, substituting any variables
- in the loaded value with the element contextual variables.
-
- Args:
- node (dict): A dictionary loaded from YAML
- member_name (str): The name of the member to fetch
- indices (list of int): List of indices to search, in case of nested lists
-
- Returns:
- The value of the list element in *member_name* at the specified *indices*
-
- Raises:
- :class:`.LoadError`
-
- This is essentially the same as :func:`~buildstream.plugin.Plugin.node_get_list_element`
- except that it assumes the expected type is a string and will also perform variable
- substitutions.
-
- **Example:**
-
- .. code:: python
-
- # Fetch the list itself
- strings = self.node_get_member(node, list, 'strings')
-
- # Iterate over the list indices
- for i in range(len(strings)):
-
- # Fetch the strings in this list, substituting content
- # with our element's variables if needed
- string = self.node_subst_list_element(
- node, 'strings', [ i ])
- """
- value = self.node_get_list_element(node, str, member_name, indices)
- try:
- return self.__variables.subst(value)
- except LoadError as e:
- provenance = _yaml.node_get_provenance(node, key=member_name, indices=indices)
- raise LoadError(e.reason, '{}: {}'.format(provenance, e), detail=e.detail) from e
-
def compute_manifest(self, *, include=None, exclude=None, orphans=True):
"""Compute and return this element's selective manifest
diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py
index e209e5f4e..2cdad410f 100644
--- a/src/buildstream/plugin.py
+++ b/src/buildstream/plugin.py
@@ -294,8 +294,7 @@ class Plugin():
For Elements, when variable substitution is desirable, the
:func:`Element.node_subst_member() <buildstream.element.Element.node_subst_member>`
- and :func:`Element.node_subst_list_element() <buildstream.element.Element.node_subst_list_element>`
- methods can be used.
+ method can be used.
"""
raise ImplError("{tag} plugin '{kind}' does not implement configure()".format(
tag=self.__type_tag, kind=self.get_kind()))