Merge pull request #122484 from MetaDark/protontricks

protontricks: 1.5.0 → 1.5.1

authored by

Sandro and committed by
GitHub
f436cc34 4abe4af3

+62 -50
+4 -7
pkgs/tools/package-management/protontricks/default.nix
··· 12 13 buildPythonApplication rec { 14 pname = "protontricks"; 15 - version = "1.5.0"; 16 17 src = fetchFromGitHub { 18 owner = "Matoking"; 19 repo = pname; 20 rev = version; 21 - hash = "sha256-IHgoi5VUN3ORbufkruPb6wR7pTekJFQHhhDrnjOWzWM="; 22 }; 23 24 patches = [ ··· 26 ./steam-run.patch 27 ]; 28 29 - preBuild = '' 30 - export SETUPTOOLS_SCM_PRETEND_VERSION="${version}" 31 - ''; 32 - 33 nativeBuildInputs = [ setuptools_scm ]; 34 propagatedBuildInputs = [ vdf ]; 35 ··· 52 meta = with lib; { 53 description = "A simple wrapper for running Winetricks commands for Proton-enabled games"; 54 homepage = "https://github.com/Matoking/protontricks"; 55 - license = licenses.gpl3; 56 maintainers = with maintainers; [ metadark ]; 57 platforms = platforms.linux; 58 };
··· 12 13 buildPythonApplication rec { 14 pname = "protontricks"; 15 + version = "1.5.1"; 16 17 src = fetchFromGitHub { 18 owner = "Matoking"; 19 repo = pname; 20 rev = version; 21 + hash = "sha256-SrBPqGRIsP0+ZWDe96sqjqCpJoY3Sn3VoPpMw7ellC0="; 22 }; 23 24 patches = [ ··· 26 ./steam-run.patch 27 ]; 28 29 + SETUPTOOLS_SCM_PRETEND_VERSION = version; 30 nativeBuildInputs = [ setuptools_scm ]; 31 propagatedBuildInputs = [ vdf ]; 32 ··· 49 meta = with lib; { 50 description = "A simple wrapper for running Winetricks commands for Proton-enabled games"; 51 homepage = "https://github.com/Matoking/protontricks"; 52 + license = licenses.gpl3Only; 53 maintainers = with maintainers; [ metadark ]; 54 platforms = platforms.linux; 55 };
+58 -43
pkgs/tools/package-management/protontricks/steam-run.patch
··· 1 diff --git a/src/protontricks/cli.py b/src/protontricks/cli.py 2 - index 9641970..6a2b268 100755 3 --- a/src/protontricks/cli.py 4 +++ b/src/protontricks/cli.py 5 @@ -15,8 +15,8 @@ import sys ··· 10 - find_steam_path, get_steam_apps, get_steam_lib_paths) 11 +from .steam import (find_proton_app, find_steam_path, get_steam_apps, 12 + get_steam_lib_paths) 13 - from .util import run_command 14 from .winetricks import get_winetricks_path 15 16 - @@ -75,8 +75,7 @@ def main(args=None): 17 "WINE: path to a custom 'wine' executable\n" 18 "WINESERVER: path to a custom 'wineserver' executable\n" 19 "STEAM_RUNTIME: 1 = enable Steam Runtime, 0 = disable Steam " ··· 23 ), 24 formatter_class=argparse.RawTextHelpFormatter 25 ) 26 - @@ -138,18 +137,9 @@ def main(args=None): 27 ) 28 sys.exit(-1) 29 ··· 44 else: 45 use_steam_runtime = False 46 logger.info("Steam Runtime disabled.") 47 - @@ -212,7 +202,6 @@ def main(args=None): 48 proton_app=proton_app, 49 steam_app=steam_app, 50 use_steam_runtime=use_steam_runtime, ··· 52 command=[winetricks_path, "--gui"], 53 use_bwrap=use_bwrap 54 ) 55 - @@ -282,7 +271,6 @@ def main(args=None): 56 proton_app=proton_app, 57 steam_app=steam_app, 58 use_steam_runtime=use_steam_runtime, ··· 60 use_bwrap=use_bwrap, 61 command=[winetricks_path] + args.winetricks_command) 62 elif args.command: 63 - @@ -292,7 +280,6 @@ def main(args=None): 64 steam_app=steam_app, 65 command=args.command, 66 use_steam_runtime=use_steam_runtime, ··· 69 # Pass the command directly into the shell *without* 70 # escaping it 71 diff --git a/src/protontricks/steam.py b/src/protontricks/steam.py 72 - index 8554e24..509afb6 100644 73 --- a/src/protontricks/steam.py 74 +++ b/src/protontricks/steam.py 75 - @@ -13,8 +13,8 @@ from .util import lower_dict 76 __all__ = ( 77 "COMMON_STEAM_DIRS", "SteamApp", "find_steam_path", 78 - "find_steam_proton_app", "find_proton_app", 79 - - "find_legacy_steam_runtime_path", "find_appid_proton_prefix", 80 - - "get_steam_lib_paths", "get_steam_apps", "get_custom_proton_installations" 81 - + "find_appid_proton_prefix", "get_steam_lib_paths", 82 - + "get_steam_apps", "get_custom_proton_installations" 83 - ) 84 - 85 - COMMON_STEAM_DIRS = [ 86 - @@ -283,37 +283,6 @@ def find_steam_path(): 87 return None, None 88 89 ··· 122 APPINFO_STRUCT_SECTION = "<LLLLQ20sL" 123 124 diff --git a/src/protontricks/util.py b/src/protontricks/util.py 125 - index 40fa752..9da5509 100644 126 --- a/src/protontricks/util.py 127 +++ b/src/protontricks/util.py 128 - @@ -25,24 +25,6 @@ def lower_dict(d): 129 return {k.lower(): v for k, v in d.items()} 130 131 ··· 150 def get_host_library_paths(): 151 """ 152 Get host library paths to use when creating the LD_LIBRARY_PATH environment 153 - @@ -54,7 +36,7 @@ def get_host_library_paths(): 154 # Since that command is unavailable with newer Steam Runtime releases, 155 # do it ourselves here. 156 result = run( ··· 159 check=True, stdout=PIPE, stderr=PIPE 160 ) 161 lines = result.stdout.decode("utf-8").split("\n") 162 - @@ -72,7 +54,7 @@ RUNTIME_ROOT_GLOB_PATTERNS = ( 163 ) 164 165 ··· 168 """ 169 Get LD_LIBRARY_PATH value to use when running a command using Steam Runtime 170 """ 171 - @@ -95,7 +77,7 @@ def get_runtime_library_paths(proton_app, use_bwrap=True): 172 ) 173 ) 174 ··· 177 return "".join([ 178 str(proton_app.proton_dist_path / "lib"), os.pathsep, 179 str(proton_app.proton_dist_path / "lib64"), os.pathsep 180 - @@ -111,14 +93,19 @@ def get_runtime_library_paths(proton_app, use_bwrap=True): 181 ]) 182 183 ··· 202 +# instead. 203 +WINE_SCRIPT_RUNTIME_V2_TEMPLATE = """#!/usr/bin/env bash 204 # Helper script created by Protontricks to run Wine binaries using Steam Runtime 205 - PROTONTRICKS_PROXY_SCRIPT_PATH="{script_path}" 206 - if [[ -n "$PROTONTRICKS_INSIDE_STEAM_RUNTIME" ]]; then 207 - @@ -127,9 +114,13 @@ if [[ -n "$PROTONTRICKS_INSIDE_STEAM_RUNTIME" ]]; then 208 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PROTON_LD_LIBRARY_PATH" 209 "$PROTON_DIST_PATH"/bin/{name} "$@" 210 else 211 - - exec "$STEAM_RUNTIME_PATH"/run --share-pid --batch --filesystem=/mnt \ 212 - - --filesystem=/tmp --filesystem=/run/media --filesystem=/etc \ 213 - - --filesystem=/opt --filesystem=/home --filesystem=/usr -- \ 214 + exec steam-run "$STEAM_RUNTIME_PATH"/pressure-vessel/bin/pressure-vessel-wrap \ 215 + --runtime-archive=$(echo "$STEAM_RUNTIME_PATH"/*runtime.tar.gz) \ 216 + --variable-dir="${{PRESSURE_VESSEL_VARIABLE_DIR:-$STEAM_RUNTIME_PATH/var}}" \ 217 + --share-pid --batch \ 218 - + --filesystem=/mnt --filesystem=/tmp --filesystem=/run/media \ 219 - + --filesystem=/etc --filesystem=/opt --filesystem=/home \ 220 - + --filesystem=/usr -- \ 221 env PROTONTRICKS_INSIDE_STEAM_RUNTIME=1 \ 222 "$PROTONTRICKS_PROXY_SCRIPT_PATH" "$@" 223 - fi 224 - @@ -194,7 +185,6 @@ def create_wine_bin_dir(proton_app, use_bwrap=True): 225 def run_command( 226 winetricks_path, proton_app, steam_app, command, 227 use_steam_runtime=False, ··· 229 use_bwrap=True, 230 **kwargs): 231 """Run an arbitrary command with the correct environment variables 232 - @@ -271,7 +261,7 @@ def run_command( 233 os.environ["STEAM_RUNTIME_PATH"] = \ 234 str(proton_app.required_tool_app.install_path) 235 os.environ["PROTON_LD_LIBRARY_PATH"] = \ ··· 238 239 runtime_name = proton_app.required_tool_app.name 240 logger.info( 241 - @@ -294,11 +284,8 @@ def run_command( 242 "Current Steam Runtime not recognized by Protontricks." 243 ) 244 else: ··· 251 252 # When Steam Runtime is enabled, create a set of helper scripts 253 # that load the underlying Proton Wine executables with Steam Runtime 254 - @@ -306,8 +293,6 @@ def run_command( 255 wine_bin_dir = create_wine_bin_dir( 256 proton_app=proton_app, use_bwrap=use_bwrap 257 ) ··· 261 os.environ["PATH"] = "".join([ 262 str(wine_bin_dir), os.pathsep, os.environ["PATH"] 263 diff --git a/tests/test_cli.py b/tests/test_cli.py 264 - index 1955d81..1de44b3 100644 265 --- a/tests/test_cli.py 266 +++ b/tests/test_cli.py 267 @@ -117,15 +117,10 @@ class TestCLIRun: ··· 299 assert command.env["STEAM_RUNTIME_PATH"] == \ 300 str(steam_runtime_soldier.install_path) 301 302 - @@ -238,10 +231,7 @@ class TestCLIRun: 303 - str(runtime_root / "lib" / "i386-linux-gnu"), os.pathsep, 304 str(runtime_root / "lib" / "x86_64-linux-gnu") 305 ])) 306 - - 307 - # Environment variables for both legacy and new Steam Runtime exist 308 - assert command.env["LEGACY_STEAM_RUNTIME_PATH"] == \ 309 - str(steam_runtime_dir / "steam-runtime") ··· 311 assert command.env["STEAM_RUNTIME_PATH"] == \ 312 str(steam_runtime_soldier.install_path) 313 314 - @@ -324,20 +314,6 @@ class TestCLIRun: 315 316 assert "Zenity is not installed" in result 317
··· 1 diff --git a/src/protontricks/cli.py b/src/protontricks/cli.py 2 + index cc65a03..5c3fc7a 100755 3 --- a/src/protontricks/cli.py 4 +++ b/src/protontricks/cli.py 5 @@ -15,8 +15,8 @@ import sys ··· 10 - find_steam_path, get_steam_apps, get_steam_lib_paths) 11 +from .steam import (find_proton_app, find_steam_path, get_steam_apps, 12 + get_steam_lib_paths) 13 + from .util import run_command, is_flatpak_sandbox 14 from .winetricks import get_winetricks_path 15 16 + @@ -77,8 +77,7 @@ def main(args=None): 17 "WINE: path to a custom 'wine' executable\n" 18 "WINESERVER: path to a custom 'wineserver' executable\n" 19 "STEAM_RUNTIME: 1 = enable Steam Runtime, 0 = disable Steam " ··· 23 ), 24 formatter_class=argparse.RawTextHelpFormatter 25 ) 26 + @@ -148,18 +147,9 @@ def main(args=None): 27 ) 28 sys.exit(-1) 29 ··· 44 else: 45 use_steam_runtime = False 46 logger.info("Steam Runtime disabled.") 47 + @@ -222,7 +212,6 @@ def main(args=None): 48 proton_app=proton_app, 49 steam_app=steam_app, 50 use_steam_runtime=use_steam_runtime, ··· 52 command=[winetricks_path, "--gui"], 53 use_bwrap=use_bwrap 54 ) 55 + @@ -292,7 +281,6 @@ def main(args=None): 56 proton_app=proton_app, 57 steam_app=steam_app, 58 use_steam_runtime=use_steam_runtime, ··· 60 use_bwrap=use_bwrap, 61 command=[winetricks_path] + args.winetricks_command) 62 elif args.command: 63 + @@ -302,7 +290,6 @@ def main(args=None): 64 steam_app=steam_app, 65 command=args.command, 66 use_steam_runtime=use_steam_runtime, ··· 69 # Pass the command directly into the shell *without* 70 # escaping it 71 diff --git a/src/protontricks/steam.py b/src/protontricks/steam.py 72 + index f9fb9ec..e1e588a 100644 73 --- a/src/protontricks/steam.py 74 +++ b/src/protontricks/steam.py 75 + @@ -12,8 +12,8 @@ from .util import lower_dict 76 + 77 __all__ = ( 78 "COMMON_STEAM_DIRS", "SteamApp", "find_steam_path", 79 + - "find_legacy_steam_runtime_path", "get_appinfo_sections", 80 + - "get_proton_appid", "find_steam_proton_app", "find_appid_proton_prefix", 81 + + "get_appinfo_sections", "get_proton_appid", 82 + + "find_steam_proton_app", "find_appid_proton_prefix", 83 + "find_proton_app", "get_steam_lib_paths", "get_compat_tool_dirs", 84 + "get_proton_installations", "get_custom_proton_installations", 85 + "find_current_steamid3", "get_appid_from_shortcut", 86 + @@ -286,37 +286,6 @@ def find_steam_path(): 87 return None, None 88 89 ··· 122 APPINFO_STRUCT_SECTION = "<LLLLQ20sL" 123 124 diff --git a/src/protontricks/util.py b/src/protontricks/util.py 125 + index 2abda99..3a25368 100644 126 --- a/src/protontricks/util.py 127 +++ b/src/protontricks/util.py 128 + @@ -4,15 +4,14 @@ import shlex 129 + import shutil 130 + import stat 131 + from pathlib import Path 132 + -from subprocess import check_output, run, PIPE 133 + +from subprocess import run, PIPE 134 + 135 + __all__ = ( 136 + "SUPPORTED_STEAM_RUNTIMES", "is_flatpak_sandbox", "lower_dict", 137 + - "get_legacy_runtime_library_paths", "get_host_library_paths", 138 + - "RUNTIME_ROOT_GLOB_PATTERNS", "get_runtime_library_paths", 139 + - "WINE_SCRIPT_RUNTIME_V1_TEMPLATE", 140 + - "WINE_SCRIPT_RUNTIME_V2_TEMPLATE", 141 + - "create_wine_bin_dir", "run_command" 142 + + "get_host_library_paths", "RUNTIME_ROOT_GLOB_PATTERNS", 143 + + "get_runtime_library_paths", "WINE_SCRIPT_RUNTIME_V1_TEMPLATE", 144 + + "WINE_SCRIPT_RUNTIME_V2_TEMPLATE", "create_wine_bin_dir", 145 + + "run_command" 146 + ) 147 + 148 + logger = logging.getLogger("protontricks") 149 + @@ -39,24 +38,6 @@ def lower_dict(d): 150 return {k.lower(): v for k, v in d.items()} 151 152 ··· 171 def get_host_library_paths(): 172 """ 173 Get host library paths to use when creating the LD_LIBRARY_PATH environment 174 + @@ -68,7 +49,7 @@ def get_host_library_paths(): 175 # Since that command is unavailable with newer Steam Runtime releases, 176 # do it ourselves here. 177 result = run( ··· 180 check=True, stdout=PIPE, stderr=PIPE 181 ) 182 lines = result.stdout.decode("utf-8").split("\n") 183 + @@ -86,7 +67,7 @@ RUNTIME_ROOT_GLOB_PATTERNS = ( 184 ) 185 186 ··· 189 """ 190 Get LD_LIBRARY_PATH value to use when running a command using Steam Runtime 191 """ 192 + @@ -109,7 +90,7 @@ def get_runtime_library_paths(proton_app, use_bwrap=True): 193 ) 194 ) 195 ··· 198 return "".join([ 199 str(proton_app.proton_dist_path / "lib"), os.pathsep, 200 str(proton_app.proton_dist_path / "lib64"), os.pathsep 201 + @@ -125,14 +106,19 @@ def get_runtime_library_paths(proton_app, use_bwrap=True): 202 ]) 203 204 ··· 223 +# instead. 224 +WINE_SCRIPT_RUNTIME_V2_TEMPLATE = """#!/usr/bin/env bash 225 # Helper script created by Protontricks to run Wine binaries using Steam Runtime 226 + set -o errexit 227 + 228 + @@ -200,7 +186,10 @@ if [[ -n "$PROTONTRICKS_INSIDE_STEAM_RUNTIME" ]]; then 229 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PROTON_LD_LIBRARY_PATH" 230 "$PROTON_DIST_PATH"/bin/{name} "$@" 231 else 232 + - exec "$STEAM_RUNTIME_PATH"/run --share-pid --batch \ 233 + exec steam-run "$STEAM_RUNTIME_PATH"/pressure-vessel/bin/pressure-vessel-wrap \ 234 + --runtime-archive=$(echo "$STEAM_RUNTIME_PATH"/*runtime.tar.gz) \ 235 + --variable-dir="${{PRESSURE_VESSEL_VARIABLE_DIR:-$STEAM_RUNTIME_PATH/var}}" \ 236 + --share-pid --batch \ 237 + "${{mount_params[@]}}" -- \ 238 env PROTONTRICKS_INSIDE_STEAM_RUNTIME=1 \ 239 "$PROTONTRICKS_PROXY_SCRIPT_PATH" "$@" 240 + @@ -266,7 +255,6 @@ def create_wine_bin_dir(proton_app, use_bwrap=True): 241 def run_command( 242 winetricks_path, proton_app, steam_app, command, 243 use_steam_runtime=False, ··· 245 use_bwrap=True, 246 **kwargs): 247 """Run an arbitrary command with the correct environment variables 248 + @@ -343,7 +331,7 @@ def run_command( 249 os.environ["STEAM_RUNTIME_PATH"] = \ 250 str(proton_app.required_tool_app.install_path) 251 os.environ["PROTON_LD_LIBRARY_PATH"] = \ ··· 254 255 runtime_name = proton_app.required_tool_app.name 256 logger.info( 257 + @@ -366,11 +354,8 @@ def run_command( 258 "Current Steam Runtime not recognized by Protontricks." 259 ) 260 else: ··· 267 268 # When Steam Runtime is enabled, create a set of helper scripts 269 # that load the underlying Proton Wine executables with Steam Runtime 270 + @@ -378,8 +363,6 @@ def run_command( 271 wine_bin_dir = create_wine_bin_dir( 272 proton_app=proton_app, use_bwrap=use_bwrap 273 ) ··· 277 os.environ["PATH"] = "".join([ 278 str(wine_bin_dir), os.pathsep, os.environ["PATH"] 279 diff --git a/tests/test_cli.py b/tests/test_cli.py 280 + index 580bb5b..3a05ad3 100644 281 --- a/tests/test_cli.py 282 +++ b/tests/test_cli.py 283 @@ -117,15 +117,10 @@ class TestCLIRun: ··· 315 assert command.env["STEAM_RUNTIME_PATH"] == \ 316 str(steam_runtime_soldier.install_path) 317 318 + @@ -239,9 +232,7 @@ class TestCLIRun: 319 str(runtime_root / "lib" / "x86_64-linux-gnu") 320 ])) 321 + 322 - # Environment variables for both legacy and new Steam Runtime exist 323 - assert command.env["LEGACY_STEAM_RUNTIME_PATH"] == \ 324 - str(steam_runtime_dir / "steam-runtime") ··· 326 assert command.env["STEAM_RUNTIME_PATH"] == \ 327 str(steam_runtime_soldier.install_path) 328 329 + @@ -324,20 +315,6 @@ class TestCLIRun: 330 331 assert "Zenity is not installed" in result 332