Compare commits
2 Commits
develop
...
bugfix/env
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c6bb8cfc3 | ||
![]() |
9244ecacf0 |
@ -2380,17 +2380,28 @@ def _concretize_from_constraints(spec_constraints, tests=False):
|
|||||||
# Accept only valid constraints from list and concretize spec
|
# Accept only valid constraints from list and concretize spec
|
||||||
# Get the named spec even if out of order
|
# Get the named spec even if out of order
|
||||||
root_spec = [s for s in spec_constraints if s.name]
|
root_spec = [s for s in spec_constraints if s.name]
|
||||||
if len(root_spec) != 1:
|
hash_spec = [s for s in spec_constraints if s.abstract_hash]
|
||||||
m = "The constraints %s are not a valid spec " % spec_constraints
|
|
||||||
m += "concretization target. all specs must have a single name "
|
error_message = "The constraints %s are not a valid spec " % spec_constraints
|
||||||
m += "constraint for concretization."
|
error_message += "concretization target. all specs must have a single name "
|
||||||
raise InvalidSpecConstraintError(m)
|
error_message += "constraint for concretization."
|
||||||
spec_constraints.remove(root_spec[0])
|
|
||||||
|
if len(root_spec) > 1:
|
||||||
|
raise InvalidSpecConstraintError(error_message)
|
||||||
|
|
||||||
|
if len(root_spec) < 1:
|
||||||
|
if len(hash_spec) < 1:
|
||||||
|
raise InvalidSpecConstraintError(error_message)
|
||||||
|
|
||||||
|
if root_spec:
|
||||||
|
spec_constraints.remove(root_spec[0])
|
||||||
|
|
||||||
|
root_spec = root_spec[0] if root_spec else Spec()
|
||||||
|
|
||||||
invalid_constraints = []
|
invalid_constraints = []
|
||||||
while True:
|
while True:
|
||||||
# Attach all anonymous constraints to one named spec
|
# Attach all anonymous constraints to one named spec
|
||||||
s = root_spec[0].copy()
|
s = root_spec.copy()
|
||||||
for c in spec_constraints:
|
for c in spec_constraints:
|
||||||
if c not in invalid_constraints:
|
if c not in invalid_constraints:
|
||||||
s.constrain(c)
|
s.constrain(c)
|
||||||
|
@ -2402,6 +2402,21 @@ def test_env_activate_default_view_root_unconditional(mutable_mock_env_path):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.regression("38510")
|
||||||
|
def test_concretize_separately_abstract_hash(install_mockery, mock_fetch):
|
||||||
|
"""Check that a root can have no name if it has a hash."""
|
||||||
|
s = Spec("trivial-install-test-package").concretized()
|
||||||
|
install(str(s))
|
||||||
|
|
||||||
|
e = ev.create("test")
|
||||||
|
e.unify = False
|
||||||
|
|
||||||
|
e.add(f"/{s.dag_hash()}")
|
||||||
|
e.concretize()
|
||||||
|
|
||||||
|
assert list(e.concretized_specs()) == [(Spec(f"/{s.dag_hash()}"), s)]
|
||||||
|
|
||||||
|
|
||||||
def test_concretize_user_specs_together():
|
def test_concretize_user_specs_together():
|
||||||
e = ev.create("coconcretization")
|
e = ev.create("coconcretization")
|
||||||
e.unify = True
|
e.unify = True
|
||||||
|
Loading…
Reference in New Issue
Block a user