graph_builder comments
@@ -108,15 +108,15 @@ class DepsGraphBuilder(object):
def _load_deps(self, dep_graph, node, down_reqs, down_ref, down_options,
check_updates, update, remote_name, processed_profile):
- """ loads a Conan object from the given file
+ """ expands the dependencies of the node, recursively
param node: Node object to be expanded in this step
down_reqs: the Requirements as coming from downstream, which can overwrite current
values
param down_ref: ConanFileReference of who is depending on current node for this expansion
"""
- # basic node configuration
+ # basic node configuration: calling configure() and requirements()
new_reqs, new_options = self._config_node(dep_graph, node, down_reqs, down_ref, down_options)
-
+ # if there are version-ranges, resolve them before expanding each of the requirements
self._resolve_deps(dep_graph, node, update, remote_name)
# Expand each one of the current requirements
@@ -136,15 +136,19 @@ class DepsGraphBuilder(object):
previous = node.public_deps.get(name)
if require.private or require.build_require or not previous:
# new node, must be added and expanded
+ # node -> new_node
new_node = self._create_new_node(node, dep_graph, require, name,
check_updates, update, remote_name,
processed_profile)
+ # The closure of a new node starts with just itself
new_node.public_closure = OrderedDict([(new_node.ref.name, new_node)])
node.public_closure[name] = new_node
if require.private or require.build_require:
+ # If the requirement is private (or build_require), a new public scope is defined
new_node.public_deps = node.public_closure
else:
+ # But if it is a normal require, the public_deps scope is the same as its parent
new_node.public_deps = node.public_deps
# add this new node to the public deps
@@ -162,6 +166,7 @@ class DepsGraphBuilder(object):
new_options, check_updates, update,
remote_name, processed_profile)
else: # a public node already exist with this name
+ # This is closing a diamond, the node is existing in the public_deps scope
alias_ref = dep_graph.aliased.get(require.ref)
# Necessary to make sure that it is pointing to the correct aliased
if alias_ref:
@@ -177,6 +182,7 @@ class DepsGraphBuilder(object):
" To change it, override it in your base requirements"
% (node.ref, require.ref, previous.ref))
+ # The existing node now has as ancestors all the ancestors of this branch
previous.ancestors.add(node.name)
previous.ancestors.update(node.ancestors)
node.public_closure[name] = previous
