Prefix conflict messages with package name (#39106)
* Prefix conflict messages with package name This patch prefixes all conflict messages with the package name to alleviate what was otherwise a very manual process. Note that this patch is a one line change but has a fairly outsized impact. * same for requires directive --------- Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
This commit is contained in:
parent
45c5af10c3
commit
23963779f4
@ -520,7 +520,8 @@ def _execute_conflicts(pkg):
|
|||||||
|
|
||||||
# Save in a list the conflicts and the associated custom messages
|
# Save in a list the conflicts and the associated custom messages
|
||||||
when_spec_list = pkg.conflicts.setdefault(conflict_spec, [])
|
when_spec_list = pkg.conflicts.setdefault(conflict_spec, [])
|
||||||
when_spec_list.append((when_spec, msg))
|
msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg
|
||||||
|
when_spec_list.append((when_spec, msg_with_name))
|
||||||
|
|
||||||
return _execute_conflicts
|
return _execute_conflicts
|
||||||
|
|
||||||
@ -896,7 +897,8 @@ def _execute_requires(pkg):
|
|||||||
|
|
||||||
# Save in a list the requirements and the associated custom messages
|
# Save in a list the requirements and the associated custom messages
|
||||||
when_spec_list = pkg.requirements.setdefault(tuple(requirement_specs), [])
|
when_spec_list = pkg.requirements.setdefault(tuple(requirement_specs), [])
|
||||||
when_spec_list.append((when_spec, policy, msg))
|
msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg
|
||||||
|
when_spec_list.append((when_spec, policy, msg_with_name))
|
||||||
|
|
||||||
return _execute_requires
|
return _execute_requires
|
||||||
|
|
||||||
|
@ -956,8 +956,8 @@ def target_ranges(self, spec, single_target_fn):
|
|||||||
return [fn.attr("node_target_satisfies", spec.name, target)]
|
return [fn.attr("node_target_satisfies", spec.name, target)]
|
||||||
|
|
||||||
def conflict_rules(self, pkg):
|
def conflict_rules(self, pkg):
|
||||||
default_msg = "{0} '{1}' conflicts with '{2}'"
|
default_msg = "{0}: '{1}' conflicts with '{2}'"
|
||||||
no_constraint_msg = "{0} conflicts with '{1}'"
|
no_constraint_msg = "{0}: conflicts with '{1}'"
|
||||||
for trigger, constraints in pkg.conflicts.items():
|
for trigger, constraints in pkg.conflicts.items():
|
||||||
trigger_msg = "conflict trigger %s" % str(trigger)
|
trigger_msg = "conflict trigger %s" % str(trigger)
|
||||||
trigger_id = self.condition(spack.spec.Spec(trigger), name=pkg.name, msg=trigger_msg)
|
trigger_id = self.condition(spack.spec.Spec(trigger), name=pkg.name, msg=trigger_msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user