mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-23 16:06:18 +01:00
The installer ships as the steam_installer package beside steam_backlog_enforcer, with its tests, docs and Proton lock. The enforcer's fast install now starts the installer from this checkout. Both appinfo.vdf readers share one key-value decoder (steam_installer.appinfo_kv), and the duplicated test fixtures and helpers are folded into conftest and _cli_helpers so the whole-tree duplicate-code check is clean. check_requirements_sync treats sibling packages as first-party. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZCxnNWLtpVwFLVk9w
58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
"""External binaries this tool shells out to, and a clear error when they're missing."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
|
|
from steam_installer import errors
|
|
|
|
TOOL_HINTS = {
|
|
"depotdownloader": (
|
|
"Run steam_installer/install_deps.sh, "
|
|
"which fetches it from the SteamRE release."
|
|
),
|
|
}
|
|
|
|
|
|
# The copy install_deps.sh manages. Preferred over whatever PATH finds first: each
|
|
# depotdownloader binary keeps its remembered login in its own IsolatedStorage
|
|
# slot, keyed by its path. With an AUR copy in /usr/bin as well, a terminal run
|
|
# (PATH has ~/.local/bin) and a sudo'd run (secure_path does not) used two
|
|
# different binaries -- one logged in, one asking for a password nobody was
|
|
# there to type.
|
|
MANAGED_DEPOTDOWNLOADER = Path.home() / ".local" / "bin" / "depotdownloader"
|
|
|
|
|
|
class DependencyError(errors.InstallerError):
|
|
"""A tool this installer shells out to is missing."""
|
|
|
|
|
|
def depotdownloader_bin() -> str:
|
|
"""The depotdownloader to run: install_deps.sh's own copy, else PATH's."""
|
|
if os.access(MANAGED_DEPOTDOWNLOADER, os.X_OK):
|
|
return str(MANAGED_DEPOTDOWNLOADER)
|
|
return "depotdownloader"
|
|
|
|
|
|
def missing_tools() -> list[str]:
|
|
"""Which required binaries are not on PATH, in the order they'd be used.
|
|
|
|
steamcmd is not one of them: app info comes from Steam's own cache and
|
|
the manifest is written by this tool.
|
|
"""
|
|
needed = ["depotdownloader"]
|
|
resolved = {"depotdownloader": depotdownloader_bin()}
|
|
return [tool for tool in needed if shutil.which(resolved.get(tool, tool)) is None]
|
|
|
|
|
|
def require() -> None:
|
|
"""Fail with the fix when a required tool is missing."""
|
|
missing = missing_tools()
|
|
if missing:
|
|
details = "; ".join(
|
|
f"`{tool}` not found -- {TOOL_HINTS[tool]}" for tool in missing
|
|
)
|
|
raise DependencyError(details)
|