diff --git a/ULWGL/ulwgl_dl_util.py b/ULWGL/ulwgl_dl_util.py index 9683d209b..9587ccae3 100644 --- a/ULWGL/ulwgl_dl_util.py +++ b/ULWGL/ulwgl_dl_util.py @@ -123,7 +123,7 @@ def _fetch_proton( proton, proton_url = files[1] proton_dir: str = proton[: proton.find(".tar.gz")] # Proton dir - console_log(f"Downloading {hash} ...") + log.console(f"Downloading {hash} ...") # Verify the scheme from Github for resources if not proton_url.startswith("https:") or not hash_url.startswith("https:"): @@ -162,7 +162,7 @@ def _fetch_proton( err: str = f"Unable to download {proton}\ngithub.com request timed out" raise TimeoutError(err) except FileNotFoundError: - console_log(f"Downloading {proton} ...") + log.console(f"Downloading {proton} ...") with urlopen(proton_url, timeout=180, context=create_default_context()) as resp: # noqa: S310 # Without Proton, the launcher will not work @@ -176,7 +176,7 @@ def _fetch_proton( with cache.joinpath(proton).open(mode="wb") as file: file.write(resp.read()) - console_log("Completed.") + log.console("Completed.") with cache.joinpath(proton).open(mode="rb") as file: if ( @@ -185,7 +185,7 @@ def _fetch_proton( ): err: str = "Digests mismatched.\nFalling back to cache ..." raise ValueError(err) - console_log(f"{proton}: SHA512 is OK") + log.console(f"{proton}: SHA512 is OK") _extract_dir(cache.joinpath(proton), steam_compat) environ["PROTONPATH"] = steam_compat.joinpath(proton_dir).as_posix() @@ -204,9 +204,9 @@ def _extract_dir(proton: Path, steam_compat: Path) -> None: log.debug("Using no filter for archive") log.warning("Archive will be extracted insecurely") - console_log(f"Extracting {proton} -> {steam_compat} ...") + log.console(f"Extracting {proton} -> {steam_compat} ...") tar.extractall(path=steam_compat.as_posix()) # noqa: S202 - console_log("Completed.") + log.console("Completed.") def _cleanup(tarball: str, proton: str, cache: Path, steam_compat: Path) -> None: @@ -214,13 +214,13 @@ def _cleanup(tarball: str, proton: str, cache: Path, steam_compat: Path) -> None We want to do this when a download for a new release is interrupted """ - console_log("Keyboard Interrupt.\nCleaning ...") + log.console("Keyboard Interrupt.\nCleaning ...") if cache.joinpath(tarball).is_file(): - console_log(f"Purging {tarball} in {cache} ...") + log.console(f"Purging {tarball} in {cache} ...") cache.joinpath(tarball).unlink() if steam_compat.joinpath(proton).is_dir(): - console_log(f"Purging {proton} in {steam_compat} ...") + log.console(f"Purging {proton} in {steam_compat} ...") rmtree(steam_compat.joinpath(proton).as_posix()) @@ -234,8 +234,8 @@ def _get_from_steamcompat( proton_dir: str = files[1][0][: files[1][0].find(".tar.gz")] for proton in steam_compat.glob("ULWGL-Proton*"): - console_log(f"{proton.name} found in: {steam_compat}") - console_log(f"Using {proton.name}") + log.console(f"{proton.name} found in: {steam_compat}") + log.console(f"Using {proton.name}") environ["PROTONPATH"] = proton.as_posix() env["PROTONPATH"] = environ["PROTONPATH"] @@ -243,7 +243,7 @@ def _get_from_steamcompat( # Notify the user that they're not using the latest if proton_dir and proton.name != proton_dir: link: str = files[1][1] - console_log( + log.console( "ULWGL-Proton is outdated.\n" f"For latest release, please download {link}" ) @@ -284,18 +284,18 @@ def _get_from_cache( if path: proton_dir: str = name[: name.find(".tar.gz")] # Proton dir - console_log(f"{name} found in: {path}") + log.console(f"{name} found in: {path}") try: _extract_dir(path, steam_compat) - console_log(f"Using {proton_dir}") + log.console(f"Using {proton_dir}") environ["PROTONPATH"] = steam_compat.joinpath(proton_dir).as_posix() env["PROTONPATH"] = environ["PROTONPATH"] return env except KeyboardInterrupt: if steam_compat.joinpath(proton_dir).is_dir(): - console_log(f"Purging {proton_dir} in {steam_compat} ...") + log.console(f"Purging {proton_dir} in {steam_compat} ...") rmtree(steam_compat.joinpath(proton_dir).as_posix()) raise @@ -310,7 +310,7 @@ def _get_latest( When the digests mismatched or when interrupted, refer to cache for an old version """ if files: - console_log("Fetching latest release ...") + log.console("Fetching latest release ...") try: tarball: str = files[1][0] @@ -318,7 +318,7 @@ def _get_latest( _fetch_proton(env, steam_compat, cache, files) - console_log(f"Using {proton_dir}") + log.console(f"Using {proton_dir}") env["PROTONPATH"] = environ["PROTONPATH"] except ValueError: log.exception("Exception")