From 949094544e479439e76581125a70c9c3c23cf997 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 14 Oct 2021 12:33:10 +0200 Subject: Constrain abstract specs rather than concatenating strings in the "when" context manager (#26700) Using the Spec.constrain method doesn't work since it might trigger a repository lookup which could break our directives and triggers a circular import error. To fix that we introduce a function to merge abstract anonymous specs, based only on package names, which does not perform any lookup in the repository. --- var/spack/repos/builtin.mock/packages/with-constraint-met/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/with-constraint-met/package.py b/var/spack/repos/builtin.mock/packages/with-constraint-met/package.py index 00c786f0b9..137e0be862 100644 --- a/var/spack/repos/builtin.mock/packages/with-constraint-met/package.py +++ b/var/spack/repos/builtin.mock/packages/with-constraint-met/package.py @@ -17,4 +17,7 @@ class WithConstraintMet(Package): with when('@1.0'): depends_on('b') - conflicts('%gcc') + conflicts('%gcc', when='+foo') + + with when('@0.14: ^b@:4.0'): + depends_on('c', when='@:15 ^b@3.8:') -- cgit v1.2.3-60-g2f50