diff --git a/.github/scripts/check_verbs.py b/.github/scripts/check_verbs.py index 1d3b199..c72c6c5 100644 --- a/.github/scripts/check_verbs.py +++ b/.github/scripts/check_verbs.py @@ -10,14 +10,12 @@ # 'gui' is a virtual verb for opening the Winetricks GUI # 'vd=1280x720' is a setting for the virtual desktop and valid -whitelist_verbs = { 'gui', 'vd=1280x720' } +whitelist_verbs = {'gui', 'vd=1280x720'} + def extract_verbs_from_glob(path_glob: iglob) -> set[str]: """Simply strip the extension from all found files.""" - return { - file.stem - for file in path_glob - } + return {file.stem for file in path_glob} def find_verbs(root: Path) -> set[str]: @@ -27,7 +25,9 @@ def find_verbs(root: Path) -> set[str]: for fix in game_fixes: f = fix.read_text() - r = re.finditer(r"util\.protontricks\s*\(\s*('|\")(?P.*)\1\s*\)", f, re.MULTILINE) + r = re.finditer( + r"util\.protontricks\s*\(\s*('|\")(?P.*)\1\s*\)", f, re.MULTILINE + ) for match in r: verbs.add(match.group('verb')) @@ -53,7 +53,9 @@ def find_valid_verbs(root: Path) -> set[str]: # Execute winetricks, suppress output print(f'Executing winetricks, using tmp path "{tmp_dir}" - this may take a moment.') - subprocess.run([wt_path, '--no-clean', 'list-all'], env=env, stdout=subprocess.DEVNULL) + subprocess.run( + [wt_path, '--no-clean', 'list-all'], env=env, stdout=subprocess.DEVNULL + ) # Get all verbs vars_glob = tmp_dir.glob('**/*.vars') @@ -85,7 +87,7 @@ def main() -> None: print(f'WARNING: The following local verbs are unused: {unused_local_verbs}') # Compare the results - #FIXME: Implement a more robust mechanism for "setting" type verbs (eg. "vd") + # FIXME: Implement a more robust mechanism for "setting" type verbs (eg. "vd") invalid_verbs = verbs - (valid_verbs | valid_verbs_local | whitelist_verbs) if invalid_verbs: raise ValueError(f'The following verbs are invalid: {invalid_verbs}') diff --git a/gamefixes-steam/1245620.py b/gamefixes-steam/1245620.py index d7629b8..bbc1aaa 100644 --- a/gamefixes-steam/1245620.py +++ b/gamefixes-steam/1245620.py @@ -3,6 +3,7 @@ from pathlib import Path from protonfixes import util + def main() -> None: game_dir = Path(util.get_game_install_path()) / 'Game' # Create the DLC.bdt file if it doesn't already exist, which is known to fix Easy AntiCheat not working for players that don't own the DLC diff --git a/gamefixes-steam/2322010.py b/gamefixes-steam/2322010.py index 3ca4e14..21e03ca 100644 --- a/gamefixes-steam/2322010.py +++ b/gamefixes-steam/2322010.py @@ -4,5 +4,6 @@ from protonfixes import util + def main() -> None: - util.set_environment('SteamDeck', '1') + util.set_environment('SteamDeck', '1') diff --git a/gamefixes-steam/271590.py b/gamefixes-steam/271590.py index e21352e..db0e775 100755 --- a/gamefixes-steam/271590.py +++ b/gamefixes-steam/271590.py @@ -8,6 +8,6 @@ def main() -> None: """Game fix for GTAV""" # Rockstar reads SteamAppId and tries to init Steam API # We want to avoid this when running from Epic for example - game_id = os.environ.get("UMU_ID") + game_id = os.environ.get('UMU_ID') if game_id and not game_id.isnumeric(): - util.del_environment("SteamAppId") + util.del_environment('SteamAppId') diff --git a/gamefixes-steam/49900.py b/gamefixes-steam/49900.py index ee4d73c..7289838 100755 --- a/gamefixes-steam/49900.py +++ b/gamefixes-steam/49900.py @@ -2,6 +2,7 @@ from protonfixes import util + def main() -> None: """Installs XNA 3.1 to avoid crash when loading levels""" util.protontricks('xna31') diff --git a/util.py b/util.py index aaaf756..9805c40 100644 --- a/util.py +++ b/util.py @@ -441,15 +441,14 @@ def patch_libcuda() -> bool: # Use subprocess.run with capture_output and explicit encoding handling try: result = subprocess.run( - [ldconfig_path, '-p'], - capture_output=True, - check=True + [ldconfig_path, '-p'], capture_output=True, check=True ) # Decode the output using utf-8 with fallback to locale preferred encoding try: output = result.stdout.decode('utf-8') except UnicodeDecodeError: import locale + encoding = locale.getpreferredencoding(False) output = result.stdout.decode(encoding, errors='replace') except subprocess.CalledProcessError as e: