concretizer: don't generate rules for empty version lists

If the version list passed to one_of_iff is empty, it still generates a
rule like this:

    node_compiler_version_satisfies("fujitsu-mpi", "arm", ":") :- 1 {  } 1.
    1 {  } 1 :- node_compiler_version_satisfies("fujitsu-mpi", "arm", ":").

The cardinality rules on the right and left above are never
satisfiale, and these rules do nothing.

- [x] Skip generating any rules at all for empty version lists.
This commit is contained in:
Todd Gamblin 2020-11-11 00:58:05 -08:00
parent 2231dfc898
commit 0620d954f5

View file

@ -573,6 +573,10 @@ def iff(self, expr1, expr2):
self.rule(head=expr2, body=expr1)
def one_of_iff(self, head, versions):
# if there are no versions, skip this one_of_iff
if not versions:
return
self.out.write("%s :- %s.\n" % (head, AspOneOf(*versions)))
self.out.write("%s :- %s.\n" % (AspOneOf(*versions), head))