utils: Replace explicit loop index handling with enumerate

Signed-off-by: Niels Thykier <niels@thykier.net>
email-direct-upload-sponsor
Niels Thykier 8 years ago
parent 06504f2ae7
commit eaf4660918

@ -793,29 +793,25 @@ def invalidate_excuses(excuses, valid, invalid):
revdeps[d].append(exc.name) revdeps[d].append(exc.name)
# loop on the invalid excuses # loop on the invalid excuses
i = 0 for i, ename in enumerate(invalid):
while i < len(invalid):
# if there is no reverse dependency, skip the item # if there is no reverse dependency, skip the item
if invalid[i] not in revdeps: if ename not in revdeps:
i += 1
continue continue
# if the dependency can be satisfied by a testing-proposed-updates excuse, skip the item # if the dependency can be satisfied by a testing-proposed-updates excuse, skip the item
if (invalid[i] + "_tpu") in valid: if (ename + "_tpu") in valid:
i += 1
continue continue
# loop on the reverse dependencies # loop on the reverse dependencies
for x in revdeps[invalid[i]]: for x in revdeps[ename]:
# if the item is valid and it is marked as `dontinvalidate', skip the item # if the item is valid and it is marked as `dontinvalidate', skip the item
if x in valid and excuses[x].dontinvalidate: if x in valid and excuses[x].dontinvalidate:
continue continue
# otherwise, invalidate the dependency and mark as invalidated and # otherwise, invalidate the dependency and mark as invalidated and
# remove the depending excuses # remove the depending excuses
excuses[x].invalidate_dep(invalid[i]) excuses[x].invalidate_dep(ename)
if x in valid: if x in valid:
p = valid.index(x) p = valid.index(x)
invalid.append(valid.pop(p)) invalid.append(valid.pop(p))
excuses[x].addhtml("Invalidated by dependency") excuses[x].addhtml("Invalidated by dependency")
excuses[x].addreason("depends") excuses[x].addreason("depends")
excuses[x].is_valid = False excuses[x].is_valid = False
i += 1

Loading…
Cancel
Save