diff options
author | Aiden Grossman <39388941+boomanaiden154@users.noreply.github.com> | 2023-08-10 01:09:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 08:09:00 +0000 |
commit | 23963779f415697682485029e4334ca48656062b (patch) | |
tree | 5f4eb6fa68164646e3d9e1cf16016a20ef826387 /lib | |
parent | 45c5af10c3e971b0a16519ff182da6149ff4bf83 (diff) | |
download | spack-23963779f415697682485029e4334ca48656062b.tar.gz spack-23963779f415697682485029e4334ca48656062b.tar.bz2 spack-23963779f415697682485029e4334ca48656062b.tar.xz spack-23963779f415697682485029e4334ca48656062b.zip |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/directives.py | 6 | ||||
-rw-r--r-- | lib/spack/spack/solver/asp.py | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index e1bb4d73e3..acb2af1a62 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -520,7 +520,8 @@ def conflicts(conflict_spec, when=None, msg=None): # Save in a list the conflicts and the associated custom messages 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 @@ -896,7 +897,8 @@ def requires(*requirement_specs, policy="one_of", when=None, msg=None): # Save in a list the requirements and the associated custom messages 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 diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 7a4117667b..acfd0326b1 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -956,8 +956,8 @@ class SpackSolverSetup: return [fn.attr("node_target_satisfies", spec.name, target)] def conflict_rules(self, pkg): - default_msg = "{0} '{1}' conflicts with '{2}'" - no_constraint_msg = "{0} conflicts with '{1}'" + default_msg = "{0}: '{1}' conflicts with '{2}'" + no_constraint_msg = "{0}: conflicts with '{1}'" for trigger, constraints in pkg.conflicts.items(): trigger_msg = "conflict trigger %s" % str(trigger) trigger_id = self.condition(spack.spec.Spec(trigger), name=pkg.name, msg=trigger_msg) |