Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pre-Run script to launch options #3336

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

cybin
Copy link
Contributor

@cybin cybin commented Apr 6, 2024

Description

Please include a summary of the change and which issue is fixed (if available).
Please also include relevant motivation and context.

Fixes #2274

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.

To test it I've set up a script to remove the EAC directory of my Star Citizen installation. Now that the directory gets cleared beforehand, it passes the hub-authentication without an error.

Take this as an initial draft that needs to be discussed/reviewed. There are several execution paths through bottles and I only tested one.

Also, the use of GtkFileDialog was not intended, but the native file chooser does not work on my system. The underlying GtkTask fails on an assertion which leads into a segfault.

- use bottle names md5 hash for directory creation
- use GtkFileDialog as native file chooser caused a segfault
  because the underlying GtkTask failed on assert
  GTK_IS_FILE_SYSTEM_MODEL (or similar)
- added fields to the launch options dialog
- added parameters to functions/methods down the execution path
Copy link
Contributor

github-actions bot commented Apr 6, 2024

Pylint result on modfied files:
************* Module bottles.frontend.cli.cli
bottles/frontend/cli/cli.py:31:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:31:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:76:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:76:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:79:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:79:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:79:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:82:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:82:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:82:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:98:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:99:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:103:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:103:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:103:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:103:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:109:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:109:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:109:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:109:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:138:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:138:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:655:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/cli/cli.py:34:0: C0103: Constant name "pkgdatadir" doesn't conform to UPPER_CASE naming style (invalid-name)
bottles/frontend/cli/cli.py:41:0: C0413: Import "from gi.repository import Gio" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:43:0: C0413: Import "from bottles.frontend.params import APP_ID" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:44:0: C0413: Import "from bottles.backend.globals import Paths" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:45:0: C0413: Import "from bottles.backend.health import HealthChecker" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:46:0: C0413: Import "from bottles.backend.managers.manager import Manager" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:47:0: C0413: Import "from bottles.backend.models.config import BottleConfig" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:48:0: C0413: Import "from bottles.backend.wine.cmd import CMD" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:49:0: C0413: Import "from bottles.backend.wine.control import Control" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:50:0: C0413: Import "from bottles.backend.wine.executor import WineExecutor" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:51:0: C0413: Import "from bottles.backend.wine.winecommand import WineCommand" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:52:0: C0413: Import "from bottles.backend.wine.reg import Reg" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:53:0: C0413: Import "from bottles.backend.wine.winepath import WinePath" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:54:0: C0413: Import "from bottles.backend.wine.regedit import Regedit" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:55:0: C0413: Import "from bottles.backend.wine.taskmgr import Taskmgr" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:56:0: C0413: Import "from bottles.backend.wine.uninstaller import Uninstaller" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:57:0: C0413: Import "from bottles.backend.wine.winecfg import WineCfg" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:58:0: C0413: Import "from bottles.backend.wine.explorer import Explorer" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:59:0: C0413: Import "from bottles.backend.wine.regkeys import RegKeys" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:60:0: C0413: Import "from bottles.backend.runner import Runner" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:61:0: C0413: Import "from bottles.backend.utils import json" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:62:0: C0413: Import "from bottles.backend.utils.manager import ManagerUtils" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:218:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:223:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:240:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:270:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:272:8: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/frontend/cli/cli.py:287:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:295:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:313:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:351:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:359:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:367:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:399:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:408:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:433:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:443:20: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:472:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:482:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:492:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:502:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:558:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:566:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:570:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:612:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:631:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:644:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/frontend/cli/cli.py:153:4: W0238: Unused private member `CLI.__clear()` (unused-private-member)
************* Module bottles.frontend.windows.launchoptions
bottles/frontend/windows/launchoptions.py:18:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/windows/launchoptions.py:179:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/windows/launchoptions.py:179:39: W0613: Unused argument 'state' (unused-argument)
bottles/frontend/windows/launchoptions.py:186:50: W0613: Unused argument 'global_value' (unused-argument)
bottles/frontend/windows/launchoptions.py:193:4: R1711: Useless return at end of function or method (useless-return)
bottles/frontend/windows/launchoptions.py:242:19: E1101: Instance of 'Error' has no 'code' member (no-member)
bottles/frontend/windows/launchoptions.py:250:20: W0107: Unnecessary pass statement (unnecessary-pass)
bottles/frontend/windows/launchoptions.py:274:19: E1101: Instance of 'Error' has no 'code' member (no-member)
bottles/frontend/windows/launchoptions.py:28:0: R0903: Too few public methods (1/2) (too-few-public-methods)
bottles/frontend/windows/launchoptions.py:22:0: C0411: standard import "gettext.gettext" should be placed before third party import "gi.repository.Gtk" and first party imports "bottles.backend.utils.manager.ManagerUtils", "bottles.backend.logger.Logger"  (wrong-import-order)
************* Module bottles.backend.wine.winecommand
bottles/backend/wine/winecommand.py:90:4: W0102: Dangerous default value {} as argument (dangerous-default-value)
bottles/backend/wine/winecommand.py:90:4: R0913: Too many arguments (12/5) (too-many-arguments)
bottles/backend/wine/winecommand.py:136:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:142:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:398:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:402:51: E1136: Value 'gpu['prime']['integrated']' is unsubscriptable (unsubscriptable-object)
bottles/backend/wine/winecommand.py:404:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:183:8: W0612: Unused variable 'is_nvidia' (unused-variable)
bottles/backend/wine/winecommand.py:450:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:459:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:475:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/wine/winecommand.py:511:32: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:520:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/wine/winecommand.py:529:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/wine/winecommand.py:545:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:550:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:555:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:651:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:662:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:700:12: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bottles/backend/wine/winecommand.py:721:23: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
************* Module bottles.backend.wine.start
bottles/backend/wine/start.py:14:4: R0913: Too many arguments (8/5) (too-many-arguments)
************* Module bottles.backend.wine.wineprogram
bottles/backend/wine/wineprogram.py:39:4: R0913: Too many arguments (10/5) (too-many-arguments)
************* Module bottles.backend.wine.executor
bottles/backend/wine/executor.py:26:4: R0913: Too many arguments (17/5) (too-many-arguments)
bottles/backend/wine/executor.py:142:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bottles/backend/wine/executor.py:200:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:293:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:304:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:340:21: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
************* Module bottles.backend.managers.manager
bottles/backend/managers/manager.py:1:0: C0302: Too many lines in module (1638/1000) (too-many-lines)
bottles/backend/managers/manager.py:182:8: W0106: Expression "self.check_dxvk(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:185:8: W0106: Expression "self.check_vkd3d(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:188:8: W0106: Expression "self.check_nvapi(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:191:8: W0106: Expression "self.check_latencyflex(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:194:8: W0106: Expression "self.check_runtimes(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:197:8: W0106: Expression "self.check_winebridge(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:200:8: W0106: Expression "self.check_runners(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:376:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:381:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/managers/manager.py:385:31: C0207: Use version.split('\n', maxsplit=1)[0] instead (use-maxsplit-arg)
bottles/backend/managers/manager.py:405:12: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/backend/managers/manager.py:416:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:421:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:467:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:496:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:633:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:638:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:707:8: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:740:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:757:16: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:827:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:884:16: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:942:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:950:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:962:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/managers/manager.py:987:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1024:8: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/backend/managers/manager.py:1025:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1033:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1041:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1048:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1055:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1065:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1088:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1094:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1100:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1107:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1110:29: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
bottles/backend/managers/manager.py:1116:26: E1101: Instance of 'list' has no 'get' member (no-member)
bottles/backend/managers/manager.py:1124:4: R0913: Too many arguments (14/5) (too-many-arguments)
bottles/backend/managers/manager.py:1228:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1249:8: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:1263:12: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:1260:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:1313:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1317:15: W0125: Using a conditional statement with a constant value (using-constant-test)
bottles/backend/managers/manager.py:1312:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1312:8: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1312:8: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1400:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:1561:8: W1510: 'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
bottles/backend/managers/manager.py:1600:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/managers/manager.py:77:0: R0904: Too many public methods (24/20) (too-many-public-methods)

@cybin
Copy link
Contributor Author

cybin commented Apr 21, 2024

Please review. I think I've catched all appeareances of 'script' and replaced them with pre_/post_script.

For Star Citizen, I'm removing the EAC directory before launch and it's not complaining about Hub authentication any more. It is basically the only use case I have.

Is there anything else left to do?

Best regards.

Copy link

fab-sonarqube bot commented May 2, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] Pre-run scripts
1 participant