fix: rank only held files in a slot

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 13:43:41 +02:00
1 parent 9ad19bdba6
commit 1f942770d5
3 files changed
+36 -1

No files matched your search

+1
View File
@@ -555,6 +555,7 @@ def _select_variants(
slot_drops, slot_undecidable = slot_mod.resolve_slot_drops(
slot_groups,
slot_mod.platform_slot_index(config, emu_profiles or {}, target_cores),
held,
)
region_drops = region_drops | slot_drops
if slot_undecidable:
+5 -1
View File
@@ -106,12 +106,14 @@ def lookup_slot(index: dict[str, dict], destination: str, name: str) -> dict | N
def resolve_slot_drops(
groups: dict[str, list[tuple[str, str]]],
index: dict[str, dict],
held: set[str] | None = None,
) -> tuple[set[str], list[str]]:
"""Destinations to skip, and the groups no declared order can decide.
Returns (drops, undecidable). A group is decided only when every candidate
declares a priority and exactly one holds the lowest; anything else keeps
every candidate.
every candidate. ``held`` names the destinations the collection holds: a
candidate it lacks ships nothing, so it neither wins nor displaces one.
"""
keep: set[str] = set()
drop: set[str] = set()
@@ -123,6 +125,8 @@ def resolve_slot_drops(
tiers: dict[tuple[str, tuple[str, ...]], list[tuple[str, int | None]]] = {}
for group_id, members in groups.items():
for destination, name in members:
if held is not None and destination not in held:
continue
entry = lookup_slot(index, destination, name)
if entry is None:
keep.add(destination)