Add "^" automatically for named conflicts that don't refer to 'this' package
See https://github.com/spack/spack/pull/38447#discussion_r1285291520
This commit is contained in:
parent
d237430f47
commit
2da34de519
@ -33,6 +33,7 @@ class OpenMpi(Package):
|
|||||||
import functools
|
import functools
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
from typing import Any, Callable, List, Optional, Set, Tuple, Union
|
from typing import Any, Callable, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
import llnl.util.lang
|
import llnl.util.lang
|
||||||
@ -518,8 +519,20 @@ def _execute_conflicts(pkg):
|
|||||||
if not when_spec:
|
if not when_spec:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# TODO: (remove after v0.21)
|
||||||
|
conflict_key = conflict_spec
|
||||||
|
s = spack.spec.Spec(conflict_spec)
|
||||||
|
if s.name and s.name != pkg.name:
|
||||||
|
warning_msg = (
|
||||||
|
f"the conflict in package '{pkg.name}' on '{conflict_spec}' should "
|
||||||
|
f"start with a '^' sigil. Not using it is deprecated as of v0.21 and"
|
||||||
|
f" will be disallowed in v0.22"
|
||||||
|
)
|
||||||
|
warnings.warn(warning_msg)
|
||||||
|
conflict_key = "^" + conflict_spec
|
||||||
|
|
||||||
# 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_key, [])
|
||||||
msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg
|
msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg
|
||||||
when_spec_list.append((when_spec, msg_with_name))
|
when_spec_list.append((when_spec, msg_with_name))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user