mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-22 23:02:19 +01:00
GET /api/compat serves every installed game's compat-tool decision as rows from the installer's own code (steam_installer/compat_rows.py, the rows --map-installed now logs from), cached by file stats. The Library page gets a Proton map view (sortable, filterable, fuzzy search, hash state, 30 s poll) and a map-installed job: POST checks the ids, the phrase "map N games" and the game-running guard; the job re-checks them and streams --map-installed --apply --yes --appids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZCxnNWLtpVwFLVk9w
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""A fake Steam root for the map-installed tests: config, app cache, manifests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
from steam_installer import anticheat, compat_apply, vdf
|
|
from steam_installer.tests._acf_helpers import stamp_native_tool
|
|
from steam_installer.tests._appinfo_blob import encode
|
|
from steam_installer.tests._map_data import CONFIG, LOCKED
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Iterable
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def build_root(
|
|
tmp_path: Path,
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
*,
|
|
cached: dict[int, dict[str, Any]],
|
|
installed: Iterable[int],
|
|
anticheat_json: bytes,
|
|
) -> Path:
|
|
"""A Steam root with the stamped tool, an app cache and installed manifests.
|
|
|
|
*cached* is the app cache's content; *installed* the appids that get an
|
|
``appmanifest`` (named ``Game<appid>``), cached or not.
|
|
"""
|
|
root = tmp_path / "Steam"
|
|
(root / "config").mkdir(parents=True)
|
|
(root / "config" / "config.vdf").write_text(CONFIG)
|
|
stamp_native_tool(root, LOCKED)
|
|
cache = tmp_path / "appinfo.vdf"
|
|
cache.write_bytes(encode(cached))
|
|
monkeypatch.setattr(
|
|
compat_apply.appinfo.appinfo_cache, "default_path", lambda: cache
|
|
)
|
|
monkeypatch.setattr(anticheat, "_download", lambda: anticheat_json)
|
|
steamapps = root / "steamapps"
|
|
steamapps.mkdir()
|
|
for appid in installed:
|
|
state = {"appid": str(appid), "name": f"Game{appid}", "InstalledDepots": {}}
|
|
(steamapps / f"appmanifest_{appid}.acf").write_text(
|
|
vdf.dumps("AppState", state)
|
|
)
|
|
return root
|