Skip to content

KeyError in Windows install for shortcut only defined for Linux #463

@larsoner

Description

@larsoner

On latest stable menuinst=2.4.2 and conda=26.1.1 (26.3.1 seems to have a separate JSON export issue on Windows 😓 ), this CI run installing a constructor-built .exe successfully installs our locally-built mne-installer-menus package:

Successful install log
MNE-Python will now be installed into this location:
C:\Users\runneradmin\mne-python\1.12.0_0
Unpacking payload...
Setting up the package cache...
Setting up the base environment...
Installing packages for base, creating shortcuts if necessary...
Preparing transaction:
...working...
done
Executing transaction:
...working...




menuinst\platforms\win.py:72: UserWarning: Quick launch menus are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
done

So far, so good. However, when I add an additional Linux-only entry to the mne-installer-menu package that gets installed:

Additional shortcut
    },
    {
      "name": "MNE-Python",
      "description": "MNE-Python generic launcher",
      "icon": "{{ MENU_DIR }}/mne_default_icon.png",
      "activate": true,
      "terminal": false,
      "command": [
        "will be overridden in platforms section"
      ],
      "platforms": {
        "linux": {
          "command": [
            "exec",
            "bash",
            "--init-file",
            "{{ MENU_DIR }}/mne_open_prompt.sh"
          ],
          "Categories": [
            "Science"
          ],
          "SingleMainWindow": true,
          "NoDisplay": true,
          "StartupWMClass": "MNE-Python"
        }
      }

In the CI run there is a (non-fatal) error logged by menuinst because it hits a KeyError: 'desktop':

Errant install log
MNE-Python will now be installed into this location:
C:\Users\runneradmin\mne-python\1.12.0_0
Unpacking payload...
Setting up the package cache...
Setting up the base environment...
Installing packages for base, creating shortcuts if necessary...
Preparing transaction:
...working...
done
Executing transaction:
...working...
menuinst\platforms\win.py:72: UserWarning: Quick launch menus are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
Terminal profiles are not available for system level installs
menuinst Exception
Traceback (most recent call last):
  File "conda\gateways\disk\create.py", line 241, in make_menu
  File "menuinst\api.py", line 191, in _install_adapter
  File "menuinst\utils.py", line 423, in wrapper_elevate
  File "menuinst\api.py", line 77, in install
  File "menuinst\platforms\win.py", line 162, in create
  File "menuinst\platforms\win.py", line 228, in _paths
KeyError: 'desktop'
done

(It seems like it shouldn't try to install this shortcut because there is no "windows" in the platforms section, so hitting an error here doesn't make sense to me...)

As an additional side note, it would be really great if some of the logging messages -- including the menuinst Exception and Quick launch menus are not available... -- gave the package + 'name' of the shortcut(s) they are referring to. Would have made this a bit easier to try to track down! In my case I was lucky because all other shortcuts are for Windows and all contained a desktop entry, so it was easy to identify the problematic one...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions