conditional deps: add parsing test
Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
parent
893d56ac2c
commit
462379b92f
@ -781,7 +781,7 @@ def __str__(self) -> str:
|
|||||||
parent = self.parent.name if self.parent else None
|
parent = self.parent.name if self.parent else None
|
||||||
child = self.spec.name if self.spec else None
|
child = self.spec.name if self.spec else None
|
||||||
virtuals_string = f"virtuals={','.join(self.virtuals)}" if self.virtuals else ""
|
virtuals_string = f"virtuals={','.join(self.virtuals)}" if self.virtuals else ""
|
||||||
when_string = f"when={self.when}" if self.when != Spec() else ""
|
when_string = f"when='{self.when}'" if self.when != Spec() else ""
|
||||||
edge_attrs = filter(lambda x: bool(x), (virtuals_string, when_string))
|
edge_attrs = filter(lambda x: bool(x), (virtuals_string, when_string))
|
||||||
return f"{parent} {self.depflag}[{' '.join(edge_attrs)}] --> {child}"
|
return f"{parent} {self.depflag}[{' '.join(edge_attrs)}] --> {child}"
|
||||||
|
|
||||||
@ -1653,9 +1653,9 @@ def edge_attributes(self) -> str:
|
|||||||
virtuals_str = f"virtuals={','.join(union.virtuals)}" if union.virtuals else ""
|
virtuals_str = f"virtuals={','.join(union.virtuals)}" if union.virtuals else ""
|
||||||
|
|
||||||
conditions = [str(c) for c in dep_conditions if c != Spec()]
|
conditions = [str(c) for c in dep_conditions if c != Spec()]
|
||||||
when_str = f"when={','.join(conditions)}" if conditions else ""
|
when_str = f"when='{','.join(conditions)}'" if conditions else ""
|
||||||
|
|
||||||
result = f"{when_str} {deptypes_str} {virtuals_str}".strip()
|
result = " ".join(filter(lambda x: bool(x), (when_str, deptypes_str, virtuals_str)))
|
||||||
if result:
|
if result:
|
||||||
result = f"[{result}]"
|
result = f"[{result}]"
|
||||||
return result
|
return result
|
||||||
|
@ -736,6 +736,18 @@ def _specfile_for(spec_str, filename):
|
|||||||
Token(SpecTokens.KEY_VALUE_PAIR, "target=x86_64"),
|
Token(SpecTokens.KEY_VALUE_PAIR, "target=x86_64"),
|
||||||
],
|
],
|
||||||
"mvapich %gcc languages:='c,c++' arch=None-None-x86_64",
|
"mvapich %gcc languages:='c,c++' arch=None-None-x86_64",
|
||||||
|
# Test conditional dependencies
|
||||||
|
(
|
||||||
|
"foo ^[when='%c' virtuals=c]gcc",
|
||||||
|
[
|
||||||
|
Token(SpecTokens.UNQUALIFIED_PACKAGE_NAME, "foo"),
|
||||||
|
Token(SpecTokens.START_EDGE_PROPERTIES, "^["),
|
||||||
|
Token(SpecTokens.KEY_VALUE_PAIR, "when='%c'"),
|
||||||
|
Token(SpecTokens.KEY_VALUE_PAIR, "virtuals=c"),
|
||||||
|
Token(SpecTokens.END_EDGE_PROPERTIES, "]"),
|
||||||
|
Token(SpecTokens.UNQUALIFIED_PACKAGE_NAME, "gcc"),
|
||||||
|
],
|
||||||
|
"foo ^[when='%c' virtuals=c] gcc",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user