summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/audit.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py
index 4fe1b1dddf..be1f72c2cf 100644
--- a/lib/spack/spack/audit.py
+++ b/lib/spack/spack/audit.py
@@ -757,6 +757,15 @@ def _issues_in_depends_on_directive(pkgs, error_cls):
]
errors.append(error_cls(summary=summary, details=details))
+ for s in (dependency_spec, when):
+ if s.virtual and s.variants:
+ summary = f"{pkg_name}: virtual dependency cannot have variants"
+ details = [
+ f"remove variants from '{str(s)}' in depends_on directive",
+ f"in {filename}",
+ ]
+ errors.append(error_cls(summary=summary, details=details))
+
# No need to analyze virtual packages
if spack.repo.PATH.is_virtual(dependency_name):
continue