Files
libretro/scripts/core/offline.py
T
Abdessamad Derraz 83e810d1b3 fix: let core.upstream refuse requests offline
RETROBIOS_OFFLINE was read by six callers and never by the network
gateway: a caller that did not pass offline=True sent the request,
untokened. core.offline holds the rule, open_retrying refuses with
OfflineError and the cached reads answer as an offline run. The callers
read the same predicate, and the tests that fake the network clear the
variable for themselves (tests.ONLINE).
2026-11-24 00:20:03 +01:00

15 lines
479 B
Python

"""Whether a run fetches nothing: the one rule core.upstream and its callers read."""
from __future__ import annotations
import os
# Set, this run fetches nothing whatever its callers pass: the test runners
# and the PR checks set it.
OFFLINE_ENV = "RETROBIOS_OFFLINE"
def run_is_offline(offline: bool | None = False) -> bool:
"""Whether this run fetches nothing: the caller's flag, or RETROBIOS_OFFLINE."""
return bool(offline) or bool(os.environ.get(OFFLINE_ENV))