Skip to content

Commit de2db79

Browse files
committed
Fix getting configuration filter for exotics only
We need to respect the original list of labels not just take the exotics. There might be some exotics that are not in the full list of labels which thus should be filtered out. Also make the logic clearer by using sets and set operations.
1 parent c554497 commit de2db79

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

build-scripts/get_labels_expr.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,20 @@ def get_labels_from_file(f_path):
3939
yield label
4040

4141
def main(labels_f_path, exotics_f_path, run_on_exotics, only_exotics):
42+
all_labels = set()
43+
exotics = set()
44+
for label in get_labels_from_file(labels_f_path):
45+
all_labels.add(label.strip())
46+
for label in get_labels_from_file(exotics_f_path):
47+
exotics.add(label.strip())
48+
4249
labels_to_run = set()
4350
if only_exotics:
44-
for label in get_labels_from_file(exotics_f_path):
45-
labels_to_run.add(label.strip())
51+
labels_to_run = all_labels.intersection(exotics)
52+
elif not run_on_exotics:
53+
labels_to_run = all_labels.difference(exotics)
4654
else:
47-
for label in get_labels_from_file(labels_f_path):
48-
labels_to_run.add(label.strip())
49-
if not run_on_exotics:
50-
for label in get_labels_from_file(exotics_f_path):
51-
labels_to_run.discard(label.strip())
55+
labels_to_run = all_labels
5256

5357
print("(", end="")
5458
labels_eqs = ('label == "%s"' % label for label in sorted(labels_to_run))

0 commit comments

Comments
 (0)