Skip to content

Commit

Permalink
Allow skipping runtime updates (#158)
Browse files Browse the repository at this point in the history
* feat: allow disabling updates to runtime

* docs: add section for UMU_RUNTIME_UPDATE

* umu_test: ensure UMU_RUNTIME_UPDATE is set

* docs: update docs

* umu_runtime: only warn of obsolete files when updating runtime
  • Loading branch information
R1kaB3rN authored Jul 26, 2024
1 parent b0a1ca1 commit 7e00027
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
5 changes: 5 additions & 0 deletions docs/umu.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ _PROTON_VERB_
_UMU_ZENITY_
Optional. Creates a *zenity*[5] popup window when downloading large files.

_UMU_RUNTIME_UPDATE_
Optional. Disables automatic updates to the *Steam Linux Runtime*[6].

Set _0_ to disable updates.

# SEE ALSO

_umu_(5), _winetricks_(1), _zenity_(1)
Expand Down
2 changes: 2 additions & 0 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def set_env(

# Runtime
env["UMU_NO_RUNTIME"] = os.environ.get("UMU_NO_RUNTIME") or ""
env["UMU_RUNTIME_UPDATE"] = os.environ.get("UMU_RUNTIME_UPDATE") or ""

return env

Expand Down Expand Up @@ -750,6 +751,7 @@ def main() -> int: # noqa: D103
"ULWGL_ID": "",
"UMU_ZENITY": "",
"UMU_NO_RUNTIME": "",
"UMU_RUNTIME_UPDATE": "",
}
command: list[AnyPath] = []
opts: list[str] = []
Expand Down
15 changes: 9 additions & 6 deletions umu/umu_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ def _install_umu(
log.debug("Destination: %s", UMU_LOCAL)

# Move each file to the destination directory, overwriting if it exists
futures.extend(
[
thread_pool.submit(_move, file, source_dir, UMU_LOCAL)
for file in source_dir.glob("*")
]
)
futures.extend([
thread_pool.submit(_move, file, source_dir, UMU_LOCAL)
for file in source_dir.glob("*")
])

# Remove the archive
futures.append(thread_pool.submit(tmp.joinpath(archive).unlink, True))
Expand Down Expand Up @@ -186,7 +184,12 @@ def setup_umu(
_install_umu(json, thread_pool)
return

if os.environ.get("UMU_RUNTIME_UPDATE") == "0":
log.debug("Runtime Platform updates disabled")
return

find_obsolete()

_update_umu(local, json, thread_pool)


Expand Down
10 changes: 9 additions & 1 deletion umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def setUp(self):
"LD_PRELOAD": "",
"WINETRICKS_SUPER_QUIET": "",
"UMU_NO_RUNTIME": "",
"UMU_RUNTIME_UPDATE": "",
}
self.user = getpwuid(os.getuid()).pw_name
self.test_opts = "-foo -bar"
Expand Down Expand Up @@ -243,7 +244,6 @@ def test_run_command_nolibc(self):
umu_run, "get_gamescope_baselayer_order", return_value=None
),
):
# TODO: Mock the call
umu_run.run_command(mock_command)
proc.assert_called_once()

Expand Down Expand Up @@ -1865,6 +1865,7 @@ def test_set_env(self):
os.environ["GAMEID"] = test_str
os.environ["STORE"] = test_str
os.environ["PROTON_VERB"] = self.test_verb
os.environ["UMU_RUNTIME_UPDATE"] = "0"
# Args
result = umu_run.parse_args()
# Check
Expand Down Expand Up @@ -1966,6 +1967,13 @@ def test_set_env(self):
"Expected STEAM_COMPAT_MOUNTS to be set",
)

# Runtime
self.assertEqual(
os.environ.get("UMU_RUNTIME_UPDATE"),
self.env["UMU_RUNTIME_UPDATE"],
"Expected UMU_RUNTIME_UPDATE to be '0'",
)

def test_set_env_winetricks(self):
"""Test set_env when using winetricks."""
result = None
Expand Down

0 comments on commit 7e00027

Please sign in to comment.