Repository: lutris/lutris

Issue:
Installation of a game requiring libretro (if that is not installed) hangs up
### Bug description

The new code (not yet in a release) that installs libretro if it is not installed before installing a game bugs to and fails with an exception. It appears to be using super() in a context where that does not work.

The traceback for this is not in the log; it comes out on stderr, I think. It is:
Traceback (most recent call last):
  File "/home/danj/Projects/lutris/lutris/installer/interpreter.py", line 161, in launch_install
    self.install_runners()
  File "/home/danj/Projects/lutris/lutris/installer/interpreter.py", line 239, in install_runners
    self.install_runner(self.runners_to_install.pop(0))
  File "/home/danj/Projects/lutris/lutris/installer/interpreter.py", line 247, in install_runner
    runner.install(
  File "/home/danj/Projects/lutris/lutris/runners/libretro.py", line 147, in install
    super().install(version=None, downloader=downloader, callback=install_core)
  File "/home/danj/Projects/lutris/lutris/runners/runner.py", line 380, in install
    self.download_and_extract(runner["url"], **opts)
  File "/home/danj/Projects/lutris/lutris/runners/runner.py", line 390, in download_and_extract
    downloader(
  File "/home/danj/Projects/lutris/lutris/gui/dialogs/download.py", line 46, in simple_downloader
    return callback(**callback_args)
  File "/home/danj/Projects/lutris/lutris/runners/runner.py", line 415, in extract
    callback()
  File "/home/danj/Projects/lutris/lutris/runners/libretro.py", line 144, in install_core
    super().install(version, downloader, callback)
RuntimeError: super(): no arguments

### How to Reproduce

Get the latest Lutris from the repo; the most recent release does not have this bug.

Uninstall libretro, if installed. We need it to install before the game. But do pre-install the PPSSPP runner.

Go to the Lutris service, and select "Steins;gate" from the community installers. Try to install it; don't worry you won't need the ROM. You won't get that far.

Try to install it. It will download and install libretro as expected, but then it hangs up and the install does not continue. It is asked where to install the game, but there's no button to accept the directory. See media below.

### Expected behavior

The install should continue normally after libretro was installed.

### Log output

```shell
INFO     2022-01-04 16:46:24,250 [startup.init_lutris:161]:Starting Lutris 0.5.9.1
WARNING  2022-01-04 16:46:24,265 [libretro.get_libretro_cores:48]:No cores found
INFO     2022-01-04 16:46:24,280 [startup.check_driver:54]:Using NVIDIA drivers 470.86 for x86_64
INFO     2022-01-04 16:46:24,280 [startup.check_driver:58]:GPU: NVIDIA GeForce RTX 3060
INFO     2022-01-04 16:46:24,281 [startup.check_driver:74]:GPU: 10DE:2503 196E:1377 (nvidia drivers)
DEBUG    2022-01-04 16:46:24,317 [http.get:81]:GET https://lutris.net/api/runtimes?enabled=1
DEBUG    2022-01-04 16:46:24,459 [http.get:81]:GET https://lutris.net/api/runtimes/icons
DEBUG    2022-01-04 16:46:24,625 [http.get:81]:GET https://api.github.com/repos/lutris/dxvk/releases
DEBUG    2022-01-04 16:46:24,729 [http.write_to_file:131]:Writing to /home/danj/.local/share/lutris/runtime/dxvk/dxvk_versions.json
DEBUG    2022-01-04 16:46:24,730 [http.get:81]:GET https://api.github.com/repos/lutris/dxvk-nvapi/releases
DEBUG    2022-01-04 16:46:24,824 [http.write_to_file:131]:Writing to /home/danj/.local/share/lutris/runtime/dxvk-nvapi/dxvk-nvapi_versions.json
DEBUG    2022-01-04 16:46:24,825 [http.get:81]:GET https://api.github.com/repos/lutris/vkd3d/releases
DEBUG    2022-01-04 16:46:24,916 [http.write_to_file:131]:Writing to /home/danj/.local/share/lutris/runtime/vkd3d/vkd3d_versions.json
DEBUG    2022-01-04 16:46:24,916 [http.get:81]:GET https://api.github.com/repos/lutris/d3d_extras/releases
DEBUG    2022-01-04 16:46:24,975 [http.write_to_file:131]:Writing to /home/danj/.local/share/lutris/runtime/d3d_extras/d3d_extras_versions.json
DEBUG    2022-01-04 16:46:24,976 [http.get:81]:GET https://api.github.com/repos/lutris/dgvoodoo2/releases
DEBUG    2022-01-04 16:46:25,090 [http.write_to_file:131]:Writing to /home/danj/.local/share/lutris/runtime/dgvoodoo2/dgvoodoo2_versions.json
INFO     2022-01-04 16:46:25,091 [startup.update_runtime:189]:Startup complete
DEBUG    2022-01-04 16:46:25,366 [lutriswindow.update_store:469]:Showing 185 games
DEBUG    2022-01-04 16:46:26,895 [lutriswindow.update_store:469]:Showing 0 games
DEBUG    2022-01-04 16:46:26,895 [lutriswindow.update_store:469]:Showing 0 games
DEBUG    2022-01-04 16:46:32,579 [http.get:81]:GET https://lutris.net/api/games?search=steins%3Bgate
DEBUG    2022-01-04 16:46:33,300 [lutriswindow.update_store:469]:Showing 16 games
WARNING  2022-01-04 16:46:34,390 [lutriswindow.on_game_selection_changed:796]:No game found. Replacing with placeholder {'id': 'steins-gate', 'appid': 'steins-gate', 'name': 'Steins;Gate', 'slug': 'steins-gate', 'service': 'lutris'}
WARNING  2022-01-04 16:46:37,250 [lutriswindow.on_game_selection_changed:796]:No game found. Replacing with placeholder {'id': 'steins-gate', 'appid': 'steins-gate', 'name': 'Steins;Gate', 'slug': 'steins-gate', 'service': 'lutris'}
WARNING  2022-01-04 16:46:37,623 [lutriswindow.on_game_selection_changed:796]:No game found. Replacing with placeholder {'id': 'steins-gate', 'appid': 'steins-gate', 'name': 'Steins;Gate', 'slug': 'steins-gate', 'service': 'lutris'}
DEBUG    2022-01-04 16:46:37,623 [grid.on_item_activated:57]:Item activated: steins-gate
DEBUG    2022-01-04 16:46:37,623 [lutriswindow.on_game_activated:845]:Looking up lutris game steins-gate
DEBUG    2022-01-04 16:46:37,624 [__init__.fetch_script:22]:Fetching installer https://lutris.net/api/installers/steins-gate
DEBUG    2022-01-04 16:46:37,624 [http.get:81]:GET https://lutris.net/api/installers/steins-gate
DEBUG    2022-01-04 16:46:37,795 [application.show_window:262]:Showing window <class 'lutris.gui.installerwindow.InstallerWindow'>steins-gate
DEBUG    2022-01-04 16:46:38,995 [displayconfig.get_current_resolution:624]:Retrieving current resolution
INFO     2022-01-04 16:46:40,113 [interpreter.get_runners_to_install:229]:Runner <lutris.runners.libretro.libretro object at 0x7fc6d8157790> needs to be installed
DEBUG    2022-01-04 16:46:40,113 [interpreter.install_runner:245]:Installing libretro
DEBUG    2022-01-04 16:46:40,113 [runner.install:354]:Installing libretro (version=None, downloader=<function simple_downloader at 0x7fc6e8345310>, callback=<function libretro.install.<locals>.install_core at 0x7fc6d812c790>)
INFO     2022-01-04 16:46:40,113 [runner.get_runner_version:309]:Getting runner information for libretro
DEBUG    2022-01-04 16:46:40,113 [http.get:81]:GET https://lutris.net/api/runners/libretro
DEBUG    2022-01-04 16:46:40,275 [downloader.start:65]:⬇ https://github.com/lutris/libretro-super/releases/download/v1.9.13.2/retroarch-v1.9.13.2-x86_64.tar.xz
DEBUG    2022-01-04 16:46:41,054 [downloader.download_cb:125]:Finished downloading https://github.com/lutris/libretro-super/releases/download/v1.9.13.2/retroarch-v1.9.13.2-x86_64.tar.xz
DEBUG    2022-01-04 16:46:41,277 [extract.extract_archive:119]:Extracting /home/danj/.cache/lutris/retroarch-v1.9.13.2-x86_64.tar.xz to /home/danj/.local/share/lutris/runners
DEBUG    2022-01-04 16:46:45,536 [system.remove_folder:223]:Removing folder /home/danj/.local/share/lutris/runners/.extract-54c2e3cc
DEBUG    2022-01-04 16:46:45,537 [extract.extract_archive:171]:Finished extracting /home/danj/.cache/lutris/retroarch-v1.9.13.2-x86_64.tar.xz to /home/danj/.local/share/lutris/runners
INFO     2022-01-04 16:47:00,379 [interpreter.revert:359]:Cancelling installation of Steins;Gate
WARNING  2022-01-04 16:47:00,379 [system.remove_folder:221]:Non existent path: /home/danj/.cache/lutris/installer/steins-gate
DEBUG    2022-01-04 16:47:00,379 [application.on_app_window_destroyed:279]:Removed window <class 'lutris.gui.installerwindow.InstallerWindow'>steins-gate
INFO     2022-01-04 16:47:01,407 [application.do_shutdown:641]:Shutting down Lutris
```


### System Information

```shell
[System]
OS:              Pop!_OS 21.10 impish
Arch:            x86_64
Kernel:          5.15.8-76051508-generic
Desktop:         GNOME
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 7 5800X 8-Core Processor
Physical cores:  8
Logical cores:   16

[Memory]
RAM:             31.4 GB
Swap:            0.0 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce RTX 3060/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 470.86
OpenGL Core:     4.6.0 NVIDIA 470.86
OpenGL ES:       OpenGL ES 3.2 NVIDIA 470.86
Vulkan:          Supported
```


### Media (optional)

![Screenshot from 2022-01-04 16-46-53](https://user-images.githubusercontent.com/6507403/148128894-861121c3-aedf-43c3-b4d4-f08b8280ecc5.png)


### Checklist:

- [X] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/runners/libretro.py b/lutris/runners/libretro.py
--- a/lutris/runners/libretro.py
+++ b/lutris/runners/libretro.py
@@ -135,18 +135,19 @@ def is_installed(self, core=None):
         return self.is_retroarch_installed() and is_core_installed
 
     def install(self, version=None, downloader=None, callback=None):
+        captured_super = super()  # super() does not work inside install_core()
 
         def install_core():
             if not version:
                 if callback:
                     callback()
             else:
-                super().install(version, downloader, callback)
+                captured_super.install(version, downloader, callback)
 
         if not self.is_retroarch_installed():
-            super().install(version=None, downloader=downloader, callback=install_core)
+            captured_super.install(version=None, downloader=downloader, callback=install_core)
         else:
-            super().install(version, downloader, callback)
+            captured_super.install(version, downloader, callback)
 
     def get_run_data(self):
         return {


Test patch: