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

Install/Remove/Uninstall from Command line without GUI #3029

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tarTG
Copy link

@tarTG tarTG commented Jul 17, 2020

Fixes #2907

Currently it works like
Silent Install
lutris --install (game slug / url) --bin_path path_to_binary1; path_to_binary2 [--install_path path_to_install_folder]

If install folder is not given, the default one is used.

Silent Remove
lutris --remove id/game_slug

Silent Uninstall
lutris --uninstall id/game_slug

Missing Runners are installed without asking
Disks are searched in the standard search paths

I don't know how to handle input menus for this case. So the program prints an error and stops.
Any suggestions?

Copy link
Contributor

@AlexanderRavenheart AlexanderRavenheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First look review, noticed some misspellings and inconsistencies.

@@ -46,6 +46,7 @@
from lutris.util.steam.appmanifest import AppManifest, get_appmanifests
from lutris.util.steam.config import get_steamapps_paths
from lutris.util.wine.dxvk import init_dxvk_versions, wait_for_dxvk_init
from lutris.installer import silient_install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change silient -> silent.

Gtk.StyleContext.add_provider_for_screen(screen, self.css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

if options.contains("install_path"):
silient_install.SilenInstall(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change silient -> silent

game_slug=game_slug,
installer_file=installer_file,
revision=revision,
binary_path=options.lookup_value("bin_path").get_string().split("; "),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there an empty space after ; in the split string?

@@ -527,3 +528,12 @@ def attach_logger(self, command):
self.widget_box.pack_end(scrolledwindow, True, True, 10)
scrolledwindow.show()
self.log_textview.show()

def set_cancle_butten_sensitive(self, sensitivity):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change cancle_butten -> cancel_button

@@ -365,7 +365,7 @@ def task(self, data):
"""
self._check_required_params("name", data, "task")
if self.parent:
GLib.idle_add(self.parent.cancel_button.set_sensitive, False)
GLib.idle_add(self.parent.cancel_button_set_sensitive, False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not defined. You defined set_cancel_button_sensitve (after correcting the mispellings reported earlier).

self._print(self.commandline, text)

# required by interpreter
def clean_widgets(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required? This SilentInstall class does not extend or inherit any class, so where is this requirement coming from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Script Interpreter requires a parent class. At the moment this is only the installer window and via this function, the script interpreter make changes on the Window.

Either there had to be a lot of changes in the script interpreter (like raising signals instead of calling the installer window as parent) or the GUI functions have to be available, so the program does not crash.
This is also the reason why there are some changes to GUI accesses like
continue_button.hide()
into functions
continue_button_hide()
Otherwise there would be a lot of GUI dependencies in the silent installer.

pass

# required by interpreter
def add_spinner(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required? This SilentInstall class does not extend or inherit any class, so where is this requirement coming from?

pass

# required by interpreter
def set_cancle_butten_sensitive(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required? This SilentInstall class does not extend or inherit any class, so where is this requirement coming from?

pass

# required by interpreter
def continue_button_hide(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required? This SilentInstall class does not extend or inherit any class, so where is this requirement coming from?

pass

def attach_logger(self, command):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this function even exist?

@AlexanderRavenheart
Copy link
Contributor

If the actions are silent then there shouldn't be any input menus or other user interaction required as that kinda defeats the purpose of being silent, right?

@tarTG
Copy link
Author

tarTG commented Jul 17, 2020

I invoke the install process, like the installwindow.
But the process and the installwindow are not decoupled and invoke each other.

The GUI functions (addSpinner etc.) are required, because of the direct GUI accesses.
Without this, i have to refactor a lot of function within the original interpreter, the installerwindow and the commands files.

@@ -216,7 +216,7 @@ def insert_disc(self, data):
"<i>%s</i>") % requires
)
if self.runner == "wine":
GLib.idle_add(self.parent.eject_button.show)
self.parent.eject_button_show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove that,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it into the installer window.
https://github.com/lutris/lutris/pull/3029/files#diff-09064015f83e9cec3fca291ce9ae5954R538-R539

Otherwise the silent installer needs an eject_button with all the GUI dependencies.
This way I only need to provide an empty function.

Copy link
Member

@strycore strycore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is extremely sloppy. Contains a bunch of typos. Makes unexpected changes to the code. Adds options that weren't planned in the initial ticket.

Fix all of it.

@strycore
Copy link
Member

Input menu values have to be passed from the command line. The unattended installer must check that all values have been provided before launching the install and quit if one is not provided/invalid.

Also, I don't think the remove command line flag should be added.

@tarTG tarTG force-pushed the master branch 2 times, most recently from 2050119 to 6a3f481 Compare July 27, 2020 14:05
@tarTG
Copy link
Author

tarTG commented Jul 27, 2020

Deleted remove command line option.
Added -input_menu option:option... for menu choices.
Check all arguments before installing.
Multiple arguments now divided by : because ; terminates command line statements.
Fixed errors and typos.

The only thing which bothers me, is that installers who don't need any files are installed with
./lutris --install installer --bin_path (random_argument)
The argument never gets evaluated but it is really ugly.

@CLAassistant

This comment was marked as spam.

@strycore strycore marked this pull request as ready for review March 16, 2021 01:37
@kirtr
Copy link

kirtr commented Jan 29, 2022

I'd love to see this feature added to Lutris. Thank you for the patches, @tarTG! It would greatly help me to automate some of the game installation for the gaming computers I maintain for our kids and their friends. Any chance of signing the Contributor License Agreement to finish this off?

game_slug=game_slug,
installer_file=installer_file,
revision=revision,
binary_path=options.lookup_value("bin_path").get_string().split(":"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're check (above) for install_path and input_menu but for bin_path no if statement ... is it safe ?

return 0

if action == "uninstall":
if not db_game or not db_game["id"]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field/key id exist necessarly ?


# Check if given files match the number of needed files in the skript. Also test if the files available
if "files" in self.script["script"]:
req_files = list(filter(lambda file: "N/A" in file[next(iter(file))], self.script["script"]["files"]))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list-comprehension is (a bit) more readable:

req_files = [file for self.script["script"]["files"] if "N/A" in file[next(iter(file))]]

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

Successfully merging this pull request may close these issues.

Unattended Install
6 participants