menuinst icon indicating copy to clipboard operation
menuinst copied to clipboard

Is the value of the "platforms" field correctly checked and used ?

Open jypeter opened this issue 6 months ago • 8 comments

Checklist

  • [X] I added a descriptive title
  • [X] I searched open reports and couldn't find a duplicate

What happened?

I have kept on playing the the turtle minimal example and I'm not sure the platforms field is checked correctly

  • The documentation says that platforms is A dictionary with up to three keys. All of them are optional but you must at least define one. The presence of a key with a non-null value enables the shortcut for that platform. If you don’t include any, shortcuts
  • The schema says: Platform-specific options. Presence of a platform field enables menu items in that platform.

I'm using a Windows computer, and I would expect that something gets installed (on Windows) only if:

  • There is a win key
  • and The value associated to the win is non-null

What do you mean by non-null value anyway? Something that is True? The turtle minimal example defines

      "platforms": {
        "linux": {},
        "osx": {},
        "win": {} }

In my opinion empty dictionaries test as False and should be considered as null values so the example is a bit odd

>>> bool(False)
False
>>> bool(None)
False
>>> bool({})
False
>>> bool({'desktop':False})
True

I have also experienced the following:

  1. If I install the Turtle example as-is, on my Windows machine, the shortcuts are installed, even in the value of the win key is (technically) False
  2. If I use an empty dictionary for platforms ( "platforms": {}), the shortcuts are still installed on my Windows computer (even if there is not even a win key!)
  3. If I only use a crappy name instead of the 3 names allowed, the shortcuts are still installed on my Windows computer
       "platforms": {
        "crappy": {}
      }
  1. If I don't define platform, the shortcuts are still installed on my Windows computer
  "menu_items": [
    {
      "name": "Launch Turtle",
      "command": ["python", "-m", "turtle"]
    }
  ]

It seems like shortcuts are always installed for Windows (regardless of how platforms is defined)

Conda Info

(base) PS C:\> conda info

     active environment : base
    active env location : C:\Utils\miniconda3_2024-03
            shell level : 3
       user config file : C:\Users\jypeter\.condarc
 populated config files : C:\Users\jypeter\.condarc
          conda version : 24.7.1
    conda-build version : not installed
         python version : 3.12.4.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=icelake
                          __conda=24.7.1=0
                          __win=0=0
       base environment : C:\Utils\miniconda3_2024-03  (writable)
      conda av data dir : C:\Utils\miniconda3_2024-03\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Utils\miniconda3_2024-03\pkgs
                          C:\Users\jypeter\.conda\pkgs
                          C:\Users\jypeter\AppData\Local\conda\conda\pkgs
       envs directories : C:\Utils\miniconda3_2024-03\envs
                          C:\Users\jypeter\.conda\envs
                          C:\Users\jypeter\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/24.7.1 requests/2.32.3 CPython/3.12.4 Windows/10 Windows/10.0.19045 solver/libmamba conda-libmamba-solver/24.7.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/.
          administrator : False
             netrc file : None
           offline mode : False

Conda Config

(base) PS C:\> conda config --show-sources
==> C:\Users\jypeter\.condarc <==
channel_priority: strict
channels:
  - conda-forge
  - defaults

Conda list

(base) PS C:\> conda list --show-channel-urls
# packages in environment at C:\Utils\miniconda3_2024-03:
#
# Name                    Version                   Build  Channel
anaconda-anon-usage       0.4.4           py312hfc23b7f_100    defaults
archspec                  0.2.3              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_0    conda-forge
brotli-python             1.1.0           py312h53d5487_1    conda-forge
bzip2                     1.0.8                h2466b09_7    conda-forge
ca-certificates           2024.7.4             h56e8100_0    conda-forge
certifi                   2024.7.4           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py312he70551f_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     24.7.1          py312h2e8e312_0    conda-forge
conda-content-trust       0.2.0              pyhd8ed1ab_0    conda-forge
conda-libmamba-solver     24.7.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.3.0              pyh7900ff3_0    conda-forge
conda-package-streaming   0.10.0             pyhd8ed1ab_0    conda-forge
console_shortcut_miniconda 0.1.1                haa95532_2    defaults
cryptography              43.0.0          py312h9500af3_0    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
expat                     2.6.2                h63175ca_0    conda-forge
fmt                       10.2.1               h181d51b_0    conda-forge
frozendict                2.4.4           py312h4389bb4_0    conda-forge
h2                        4.1.0              pyhd8ed1ab_0    conda-forge
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
idna                      3.7                pyhd8ed1ab_0    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_0    conda-forge
jsonpointer               3.0.0           py312h2e8e312_0    conda-forge
krb5                      1.21.3               hdf4eb48_0    conda-forge
libarchive                3.7.4                haf234dc_0    conda-forge
libcurl                   8.9.1                h18fefc2_0    conda-forge
libexpat                  2.6.2                h63175ca_0    conda-forge
libffi                    3.4.4                hd77b12b_0    defaults
libiconv                  1.17                 hcfcfb64_2    conda-forge
libmamba                  1.5.8                h3f09ed1_0    conda-forge
libmambapy                1.5.8           py312h66cf91f_0    conda-forge
libsolv                   0.7.30               hbb528cf_0    conda-forge
libsqlite                 3.46.0               h2466b09_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libxml2                   2.12.7               h0f24e4e_4    conda-forge
libzlib                   1.3.1                h2466b09_1    conda-forge
lz4-c                     1.9.4                hcfcfb64_0    conda-forge
lzo                       2.10              hcfcfb64_1001    conda-forge
mamba                     1.5.8           py312h5494d5c_0    conda-forge
menuinst                  2.1.1           py312h275cf98_0    conda-forge
openssl                   3.3.1                h2466b09_2    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pcre2                     10.44                h3d7b363_0    conda-forge
pip                       24.2               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.2              pyhd8ed1ab_0    conda-forge
pluggy                    1.5.0              pyhd8ed1ab_0    conda-forge
powershell_shortcut_miniconda 0.0.1                haa95532_2    defaults
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6           py312he70551f_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.12.4          h889d299_0_cpython    conda-forge
python_abi                3.12                    4_cp312    conda-forge
reproc                    14.2.4.post0         hcfcfb64_1    conda-forge
reproc-cpp                14.2.4.post0         h63175ca_1    conda-forge
requests                  2.32.3             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.18.6          py312he70551f_0    conda-forge
ruamel.yaml.clib          0.2.8           py312he70551f_0    conda-forge
setuptools                71.0.4             pyhd8ed1ab_0    conda-forge
sqlite                    3.46.0               h2466b09_0    conda-forge
tk                        8.6.13               h5226925_1    conda-forge
tqdm                      4.66.4             pyhd8ed1ab_0    conda-forge
truststore                0.8.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   2.2.2              pyhd8ed1ab_1    conda-forge
vc                        14.3                h8a93ad2_20    conda-forge
vc14_runtime              14.40.33810         ha82c5b3_20    conda-forge
vs2015_runtime            14.40.33810         h3bf8584_20    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
xz                        5.4.6                h8cc25b3_0    defaults
yaml-cpp                  0.8.0                h63175ca_0    conda-forge
zlib                      1.3.1                h2466b09_1    conda-forge
zstandard                 0.23.0          py312h7606c53_0    conda-forge
zstd                      1.5.6                h0ea2cb4_0    conda-forge

Additional Context

This may be also related to #234

jypeter avatar Aug 01 '24 12:08 jypeter