conditional deps: bugfix for type mismatch in _add_dependency

Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
Gregory Becker 2025-04-22 17:29:01 -07:00
parent ce3fcf011f
commit d792121cde
No known key found for this signature in database
GPG Key ID: 2362541F6D14ED84

View File

@ -1780,6 +1780,9 @@ def _add_dependency(
direct: if True denotes a direct dependency (associated with the % sigil)
when: if non-None, condition under which dependency holds
"""
if when is None:
when = Spec()
if spec.name not in self._dependencies or not spec.name:
self.add_dependency_edge(
spec, depflag=depflag, virtuals=virtuals, direct=direct, when=when
@ -1839,6 +1842,9 @@ def add_dependency_edge(
direct: if True denotes a direct dependency
when: if non-None, condition under which dependency holds
"""
if when is None:
when = Spec()
# Check if we need to update edges that are already present
selected = self._dependencies.select(child=dependency_spec.name)
for edge in selected: