spack/lib/spack
Todd Gamblin 62da76cb5d
directives: depends_on should not admit anonymous specs (#34368)
Writing a long dependency like:

```python
     depends_on(
         "llvm"
         "targets=amdgpu,bpf,nvptx,webassembly"
         "version_suffix=jl +link_llvm_dylib ~internal_unwind"
     )
```

when it should be formatted like this:

```python
     depends_on(
         "llvm"
         " targets=amdgpu,bpf,nvptx,webassembly"
         " version_suffix=jl +link_llvm_dylib ~internal_unwind"
     )
```

can cause really subtle errors. Specifically, you'll get something like this in
the package sanity tests:

```
    AttributeError: 'NoneType' object has no attribute 'rpartition'
```

because Spack happily constructs a class that has a dependency with name `None`.

We can catch this earlier by banning anonymous dependency specs directly in
`depends_on()`.  This causes the package itself to fail to parse, and emits
a much better error message:

```
==> Error: Invalid dependency specification in package 'julia':
    llvmtargets=amdgpu,bpf,nvptx,webassemblyversion_suffix=jl +link_llvm_dylib ~internal_unwind
```
2022-12-12 11:24:28 +01:00
..
docs parser: refactor with coarser token granularity (#34151) 2022-12-07 14:56:53 -08:00
env Control Werror by converting to Wno-error (#30882) 2022-11-23 12:29:17 -08:00
external Stop using six in Spack (#33905) 2022-11-15 10:07:54 +01:00
llnl Windows: reenable unit tests (#33385) 2022-12-09 13:27:46 +00:00
spack directives: depends_on should not admit anonymous specs (#34368) 2022-12-12 11:24:28 +01:00
spack_installable Remove support for running with Python 2.7 (#33063) 2022-11-14 13:11:28 +01:00