in src/buildstream/_loader/loadelement.pyx [0:0]
def __cinit__(self, MappingNode node, str filename, object loader):
#
# Public members
#
self.kind = None # The Element kind
self.node = node # The YAML node
self.name = filename # The element name
self.full_name = None # The element full name (with associated junction)
self.node_id = _next_synthetic_counter()
self.link_target = None # The target of a link element (ScalarNode)
self.fully_loaded = False # Whether we entered the loop to load dependencies or not
#
# Private members
#
self._loader = loader # The Loader object
self._dep_cache = None # The dependency cache, to speed up depends()
#
# Initialization
#
if loader.project.junction:
# dependency is in subproject, qualify name
self.full_name = '{}:{}'.format(loader.project.junction._get_full_name(), self.name)
else:
# dependency is in top-level project
self.full_name = self.name
self.dependencies = []
# Ensure the root node is valid
self.node.validate_keys(_valid_element_keys)
self.kind = node.get_str(Symbol.KIND, default=None)
self.description = node.get_str(Symbol.DESCRIPTION, default=None)
self.first_pass = self.kind in ("junction", "link")
#
# If this is a link, resolve it right away and just
# store the link target and provenance
#
if self.kind == 'link':
# Avoid cyclic import here
from ..element import Element
element = Element._new_from_load_element(self)
# Custom error for link dependencies, since we don't completely
# parse their dependencies we cannot rely on the built-in ElementError.
deps = extract_depends_from_node(self.node)
if deps:
raise LoadError(
"{}: Dependencies are forbidden for 'link' elements".format(element),
LoadErrorReason.LINK_FORBIDDEN_DEPENDENCIES
)
self.link_target = element.target_node
# We don't count progress for junction elements or link
# as they do not represent real elements in the build graph.
#
# We check for a `None` kind, to avoid reporting progress for
# the virtual toplevel element used to load the pipeline.
#
if self._loader.load_context.task and self.kind is not None and not self.first_pass:
self._loader.load_context.task.add_current_progress()