mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
Keep x86-64 Proton builds out of the automatic default tool
This commit is contained in:
1 parent
17c0af445e
commit
cc8bb7b0a8
2 files changed
+52
-3
No files matched your search
@@ -1393,10 +1393,18 @@ def tool_catalog(steam_root, extras=None):
|
||||
continue
|
||||
extras[first_key(os.path.join(tool_dir, "compatibilitytool.vdf"), ["compatibilitytools", "compat_tools"]) or entry] = entry
|
||||
for name, entry in sorted(extras.items()):
|
||||
catalog.append(tool_entry(name, display_name(entry), os.path.join(tools, entry), False))
|
||||
tool = tool_entry(name, display_name(entry), os.path.join(tools, entry), False)
|
||||
if x86_64_layout(os.path.join(tools, entry)):
|
||||
tool["x86_64"] = True
|
||||
catalog.append(tool)
|
||||
return catalog
|
||||
|
||||
|
||||
def x86_64_layout(path):
|
||||
return (os.path.isdir(os.path.join(path, "files", "lib", "wine", "x86_64-unix")) and
|
||||
not os.path.isdir(os.path.join(path, "files", "bin-arm64")))
|
||||
|
||||
|
||||
def built_from(name, catalog, runnable=None):
|
||||
depot = VALVE_DEPOTS.get(name)
|
||||
tools = [t["name"] for t in catalog if depot and t["valve"] and t["dir"] == depot and
|
||||
@@ -1535,7 +1543,7 @@ ARCH_WORDS = re.compile(r"(?i)aarch64|arm64|x86_64|x86-64|amd64")
|
||||
|
||||
def own_builds(tools):
|
||||
return [t for t in tools if isinstance(t, dict) and not t.get("valve") and
|
||||
isinstance(t.get("dir"), str) and t["dir"].startswith(OWN_PROTON) and t.get("name")]
|
||||
isinstance(t.get("dir"), str) and t["dir"].startswith(OWN_PROTON) and t.get("name") and not t.get("x86_64")]
|
||||
|
||||
|
||||
def build_key(name):
|
||||
@@ -1770,7 +1778,11 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non
|
||||
read_json(state_path("request.json", directory)), catalog)
|
||||
else:
|
||||
default = state.get("default") if state.get("default") in names else TOOL
|
||||
if settle and newest and default == TOOL and state.get("source") not in ("app", "steam"):
|
||||
automatic = state.get("source") not in ("app", "steam")
|
||||
if settle and automatic and default in {t["name"] for t in catalog if t.get("x86_64")}:
|
||||
default = newest or TOOL
|
||||
state.update(default=default, seq=now_ms(), source="update")
|
||||
elif settle and newest and default == TOOL and automatic:
|
||||
default = newest
|
||||
state.update(default=newest, seq=now_ms(), source="update")
|
||||
state.pop("own_proton", None)
|
||||
|
||||
@@ -15,6 +15,8 @@ VALVE_11 = {"name": COMPAT["TOOL_11"], "display": "Proton 11.0 ARM64", "dir": CO
|
||||
GE = {"name": "GE-Proton11-7", "display": "GE-Proton11-7", "dir": "GE-Proton11-7", "valve": False}
|
||||
GE10 = {"name": "GE-Proton10-3", "display": "GE-Proton10-3", "dir": "GE-Proton10-3", "valve": False}
|
||||
NEWER = {"name": "DroidDeck-Proton-11-12.1", "display": "DroidDeck-Proton 11-12.1", "dir": "DroidDeck-Proton 11-12.1", "valve": False}
|
||||
X86 = {"name": "DroidDeck-Proton-11-14.2-x86_64", "display": "DroidDeck-Proton 11-14.2 x86-64", "dir": "DroidDeck-Proton 11-14.2 x86-64",
|
||||
"valve": False, "x86_64": True}
|
||||
|
||||
|
||||
def config_text(entries):
|
||||
@@ -204,6 +206,41 @@ class DroidDeckProtonDefaultTest(unittest.TestCase):
|
||||
self.assertEqual(newest, "b")
|
||||
self.assertEqual(gone, {OLD["name"]})
|
||||
|
||||
def test_an_x86_64_build_never_becomes_the_automatic_default(self):
|
||||
default, mapping, state = self.run_default(
|
||||
{"default": TOOL, "auto": {"42": TOOL}}, [("0", TOOL), ("42", TOOL)], [VALVE, NEW, X86], ["42"])
|
||||
self.assertEqual((default, mapping["0"]), (NEW["name"], NEW["name"]))
|
||||
default, mapping, _ = self.run_default({"default": TOOL}, [("0", TOOL)], [VALVE, X86])
|
||||
self.assertEqual((default, mapping), (TOOL, {"0": TOOL}))
|
||||
|
||||
def test_an_automatic_x86_64_default_moves_back_to_arm64(self):
|
||||
default, mapping, state = self.run_default(
|
||||
{"default": X86["name"], "written": X86["name"], "source": "update"}, [("0", X86["name"])], [VALVE, NEW, X86])
|
||||
self.assertEqual((default, mapping, state["source"]), (NEW["name"], {"0": NEW["name"]}, "update"))
|
||||
default, mapping, _ = self.run_default(
|
||||
{"default": X86["name"], "written": X86["name"], "source": "update"}, [("0", X86["name"])], [VALVE, X86])
|
||||
self.assertEqual((default, mapping), (TOOL, {"0": TOOL}))
|
||||
|
||||
def test_an_x86_64_default_the_user_picked_is_kept(self):
|
||||
for source in ("app", "steam"):
|
||||
default, mapping, _ = self.run_default(
|
||||
{"default": X86["name"], "written": X86["name"], "source": source}, [("0", X86["name"])], [VALVE, NEW, X86])
|
||||
self.assertEqual((default, mapping), (X86["name"], {"0": X86["name"]}))
|
||||
|
||||
def test_x86_64_layouts_are_marked_in_the_catalog(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tools = Path(tmp) / "compatibilitytools.d"
|
||||
for entry, arm in (("DroidDeck-Proton 11-14.2 x86-64", False), ("DroidDeck-Proton 11-14.2", True)):
|
||||
(tools / entry / "files" / "lib" / "wine" / ("aarch64-unix" if arm else "x86_64-unix")).mkdir(parents=True)
|
||||
if arm:
|
||||
(tools / entry / "files" / "bin-arm64").mkdir()
|
||||
(tools / entry / COMPAT["EXTRA_WRAPPER"]).write_text("")
|
||||
catalog = {t["dir"]: t for t in COMPAT["tool_catalog"](tmp) if not t["valve"]}
|
||||
self.assertTrue(catalog["DroidDeck-Proton 11-14.2 x86-64"].get("x86_64"))
|
||||
self.assertNotIn("x86_64", catalog["DroidDeck-Proton 11-14.2"])
|
||||
newest, _ = COMPAT["own_proton_moves"]({}, list(catalog.values()))
|
||||
self.assertEqual(newest, catalog["DroidDeck-Proton 11-14.2"]["name"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user