summaryrefslogtreecommitdiff
path: root/NOTICE
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-07-02 17:43:15 +0200
committerGitHub <noreply@github.com>2021-07-02 08:43:15 -0700
commit3d11716e5446ecb4555ad905dcfe16fe9d03d1cb (patch)
tree6cc0c64699d6417747cf9d191de458ce052310f9 /NOTICE
parentf88d90e43206f20f71f9ad2b83568f09f5d0e6b4 (diff)
downloadspack-3d11716e5446ecb4555ad905dcfe16fe9d03d1cb.tar.gz
spack-3d11716e5446ecb4555ad905dcfe16fe9d03d1cb.tar.bz2
spack-3d11716e5446ecb4555ad905dcfe16fe9d03d1cb.tar.xz
spack-3d11716e5446ecb4555ad905dcfe16fe9d03d1cb.zip
Add `when` context manager to group common constraints in packages (#24650)
This PR adds a context manager that permit to group the common part of a `when=` argument and add that to the context: ```python class Gcc(AutotoolsPackage): with when('+nvptx'): depends_on('cuda') conflicts('@:6', msg='NVPTX only supported in gcc 7 and above') conflicts('languages=ada') conflicts('languages=brig') conflicts('languages=go') ``` The above snippet is equivalent to: ```python class Gcc(AutotoolsPackage): depends_on('cuda', when='+nvptx') conflicts('@:6', when='+nvptx', msg='NVPTX only supported in gcc 7 and above') conflicts('languages=ada', when='+nvptx') conflicts('languages=brig', when='+nvptx') conflicts('languages=go', when='+nvptx') ``` which needs a repetition of the `when='+nvptx'` argument. The context manager might help improving readability and permits to group together directives related to the same semantic aspect (e.g. all the directives needed to model the behavior of `gcc` when `+nvptx` is active). Modifications: - [x] Added a `when` context manager to be used with package directives - [x] Add unit tests and documentation for the new feature - [x] Modified `cp2k` and `gcc` to show the use of the context manager
Diffstat (limited to 'NOTICE')
0 files changed, 0 insertions, 0 deletions