Rename "main_node" -> "make_node"

This commit is contained in:
Massimiliano Culpo 2023-08-14 11:16:04 +02:00 committed by Todd Gamblin
parent 34ebe7f53c
commit 1db91e0ccd
2 changed files with 8 additions and 8 deletions

View file

@ -525,12 +525,12 @@ def _compute_specs_from_answer_set(self):
best = min(self.answers) best = min(self.answers)
opt, _, answer = best opt, _, answer = best
for input_spec in self.abstract_specs: for input_spec in self.abstract_specs:
node = SpecBuilder.main_node(pkg=input_spec.name) node = SpecBuilder.make_node(pkg=input_spec.name)
if input_spec.virtual: if input_spec.virtual:
providers = [ providers = [
spec.name for spec in answer.values() if spec.package.provides(input_spec.name) spec.name for spec in answer.values() if spec.package.provides(input_spec.name)
] ]
node = SpecBuilder.main_node(pkg=providers[0]) node = SpecBuilder.make_node(pkg=providers[0])
candidate = answer.get(node) candidate = answer.get(node)
if candidate and candidate.satisfies(input_spec): if candidate and candidate.satisfies(input_spec):
@ -2563,8 +2563,8 @@ class SpecBuilder:
) )
@staticmethod @staticmethod
def main_node(*, pkg: str) -> NodeArgument: def make_node(*, pkg: str) -> NodeArgument:
"""Given a package name, returns the string representation of the root node in """Given a package name, returns the string representation of the "min_dupe_id" node in
the ASP encoding. the ASP encoding.
Args: Args:
@ -2663,7 +2663,7 @@ def external_spec_selected(self, node, idx):
extendee_spec = package.extendee_spec extendee_spec = package.extendee_spec
if extendee_spec: if extendee_spec:
extendee_node = SpecBuilder.main_node(pkg=extendee_spec.name) extendee_node = SpecBuilder.make_node(pkg=extendee_spec.name)
package.update_external_dependencies(self._specs.get(extendee_node, None)) package.update_external_dependencies(self._specs.get(extendee_node, None))
def depends_on(self, parent_node, dependency_node, type): def depends_on(self, parent_node, dependency_node, type):
@ -2712,11 +2712,11 @@ def reorder_flags(self):
# order is determined by the DAG. A spec's flags come after any of its ancestors # order is determined by the DAG. A spec's flags come after any of its ancestors
# on the compile line # on the compile line
node = SpecBuilder.main_node(pkg=spec.name) node = SpecBuilder.make_node(pkg=spec.name)
source_key = (node, flag_type) source_key = (node, flag_type)
if source_key in self._flag_sources: if source_key in self._flag_sources:
order = [ order = [
SpecBuilder.main_node(pkg=s.name) SpecBuilder.make_node(pkg=s.name)
for s in spec.traverse(order="post", direction="parents") for s in spec.traverse(order="post", direction="parents")
] ]
sorted_sources = sorted( sorted_sources = sorted(

View file

@ -2983,7 +2983,7 @@ def _new_concretize(self, tests=False):
providers = [spec.name for spec in answer.values() if spec.package.provides(name)] providers = [spec.name for spec in answer.values() if spec.package.provides(name)]
name = providers[0] name = providers[0]
node = spack.solver.asp.SpecBuilder.main_node(pkg=name) node = spack.solver.asp.SpecBuilder.make_node(pkg=name)
assert ( assert (
node in answer node in answer
), f"cannot find {name} in the list of specs {','.join([n.pkg for n in answer.keys()])}" ), f"cannot find {name} in the list of specs {','.join([n.pkg for n in answer.keys()])}"