spack/lib/spack
Harmen Stoppels 1235084c20
Introduce default_args context manager (#39964)
This adds a rather trivial context manager that lets you deduplicate repeated
arguments in directives, e.g.

```python
depends_on("py-x@1", when="@1", type=("build", "run"))
depends_on("py-x@2", when="@2", type=("build", "run"))
depends_on("py-x@3", when="@3", type=("build", "run"))
depends_on("py-x@4", when="@4", type=("build", "run"))
```

can be condensed to

```python
with default_args(type=("build", "run")):
    depends_on("py-x@1", when="@1")
    depends_on("py-x@2", when="@2")
    depends_on("py-x@3", when="@3")
    depends_on("py-x@4", when="@4")
```

The advantage is it's clear for humans, the downside it's less clear for type checkers due to type erasure.
2023-11-06 10:22:29 -08:00
..
docs Introduce default_args context manager (#39964) 2023-11-06 10:22:29 -08:00
env cc: Ensure that user-specified flags take precedence over others (#37376) 2023-06-18 14:07:08 -07:00
external Update archspec to latest commit (#39920) 2023-09-11 10:03:35 -07:00
llnl tty: flush immediately (#40774) 2023-10-30 15:07:30 +01:00
spack Introduce default_args context manager (#39964) 2023-11-06 10:22:29 -08:00
spack_installable license year bump (#34921) 2023-01-18 14:30:17 -08:00