ynput / ayon-launcher

AYON desktop application launcher
Apache License 2.0
31 stars 13 forks source link

Shims for AYON launcher executables #112

Closed iLLiCiTiT closed 3 weeks ago

iLLiCiTiT commented 4 months ago

Changelog Description

Implemented simple shims which can redirect to ayon launcher version.

Additional info

Shims are meant to help with registering of path to AYON launcher. Right now you can point to a single version of AYON launcher, which would stop to work when the version is uninstalled because new version is available. Only think which shim does is to find an existing ayon launcher and execute it, it does not download it or handle logic.

The downside of this approach is that it does not handle cases when there are any available versions. In that case it just crashes. It also does not autodetect available versions, so the new launcher must be launched at least once so shim can find it.

The shim is versioned with version file which contains version raw string. This file was used instead of version.py because of potential future change of implementation from Python to C++.

AYON launcher has new argument handling. When "init-ayon-launcher" is passed it just stores information about executable and deploys shims witout any other action.

Full feature set of this PR

Warning

On windows and linux is shim launching new ayon launcher and the shim process ends after the AYON launcher process ends and is using the same exit code and is passing in stdout and stderr (if is available). That is not true on macOs where shim only opens new launcher and ends.

Reason: Shim is used for webactions, api of uri handling on macOs is based on events (launch process and send event to start uri). The issue is that only one process of the application can be running to be able to achieve this. Any future process just won't start.

Possible issues: If the exectable is used in a automation that should wait for the process to "finish", it is not possible.

Testing notes:

  1. Run Create env command.
  2. Run build and make installer.
  3. Install AYON launcher on windows. Start unpacked AYON launcher at least once on linux and mac.
  4. On Windows It should create shims on your machine (%LOCALAPPDATA%\Ynput\AYON\shim\).
  5. For other platforms the shims are created when the AYON launcher is launched for a first time.
  6. When you run the shim it should start AYON launcher.

If you're retesting this PR, make sure to reinstall venv and remove existing AYON launcher. Also remove existing shim, %LOCALAPPDATA%\Ynput\AYON\shim\ on windows /Applications/AYON.app on macOs and ~/.local/AYON/shim on linux.

Webactions

Shims added option to use webactions. For that make sure you have

ynbot commented 3 months ago

Task linked: AY-5077 AYON launcher shims

64qam commented 1 month ago

Launcher on Windows is working only via command line. When starting from Total Commnader, ayon_console.exe immediately close the pop up console and ayon.exe crashes with the error: image

64qam commented 1 month ago

Linux (Rocky8, Rocky9), Mac:


  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 829, in <module>
    main()
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 822, in main
    post_build_process(ayon_root, build_root)
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 605, in post_build_process
    copy_shim_to_build(ayon_root, build_content_root)
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 232, in copy_shim_to_build
    with open(dist_root / "version", "r") as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/ynput/ayon/ayon-launcher/shim/dist/version'```
64qam commented 4 weeks ago

Still the same. On Mac login window always pops up. On Rocky launcher doesn't start.

fabiaserra commented 1 week ago

got this error building ayon-launcher:

Traceback (most recent call last):
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 362, in <module>
    main()
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 346, in main
    func(**result_dict)
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 240, in cli_upload
    installer_info: InstallerInfo = find_installer_info(installer_dir)
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 107, in find_installer_info
    return InstallerInfo(installer_path=str(installer_path), **metadata)
TypeError: __init__() got an unexpected keyword argument 'distro_short'

I fixed it by adding distro_short on the InstallerInfo:

@dataclass
class InstallerInfo:
    version: str
    platform: str
    filename: str
    installer_path: str
    python_version: str
    checksum: str
    checksum_algorithm: str
    size: int
    python_modules: dict[str, str]
    runtime_python_modules: dict[str, str]
    distro_short: str
iLLiCiTiT commented 1 week ago

Not related to this PR but https://github.com/ynput/ayon-launcher/pull/158 , fixed in develop.