Fix the logic around whether or not a version is available

This commit is contained in:
MKLeb 2023-09-26 12:20:10 -04:00 committed by Pedro Algarvio
parent 3b3b9fbc49
commit 398056dafb

View file

@ -843,12 +843,12 @@ def pkg_matrix(
key_filter = (
f"Contents[?contains(Key, '{version}')] | [?ends_with(Key, '.exe')]"
)
# objects = list(page_iterator.search(f"Contents[?contains(Key, '{key_filter}')][]"))
objects = page_iterator.search(key_filter)
# ctx.info(objects)
try:
first = next(objects)
ctx.info(f"Found {version} ({backend}) for {distro_slug}: {first['Key']}")
objects = list(page_iterator.search(key_filter))
# Testing using `any` because sometimes the paginator returns `[None]`
if any(objects):
ctx.info(
f"Found {version} ({backend}) for {distro_slug}: {objects[0]['Key']}"
)
for session in ("upgrade", "downgrade"):
matrix.append(
{
@ -858,7 +858,7 @@ def pkg_matrix(
"version": str(version),
}
)
except StopIteration:
else:
ctx.info(f"No {version} ({backend}) for {distro_slug} at {prefix}")
ctx.info("Generated matrix:")