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

PY_VER placeholder not defined/updated correctly on Windows #235

Open
2 tasks done
jypeter opened this issue Jul 31, 2024 · 0 comments
Open
2 tasks done

PY_VER placeholder not defined/updated correctly on Windows #235

jypeter opened this issue Jul 31, 2024 · 0 comments
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@jypeter
Copy link

jypeter commented Jul 31, 2024

Checklist

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

What happened?

I have used the turtle minimal example json file in order to test menuinst, on my Windows 10 computer, using the latest menuinst version available from conda-forge (2.1.1) and I ended up with a new Python N.A menu, which did not seem completely right

  • the turtle example file uses: "menu_name": "Python {{ PY_VER }}",
  • the general placeholders documentation says that PY_VER should be Python major.minor version in PREFIX, so probably something else than N.A

Some quick digging showed me that placeholders is defined in ./platforms/base.py

    def placeholders(self) -> Dict[str, str]:
        """
        Additional placeholders added at runtime:
        - MENU_ITEM_LOCATION -> *MenuItem().location

        Subclasses may extend this dictionary!
        """
        return {
            "BASE_PREFIX": str(self.base_prefix),
            "DISTRIBUTION_NAME": self.base_prefix.name,
            "BASE_PYTHON": str(self.base_prefix / "bin" / "python"),
            "PREFIX": str(self.prefix),
            "ENV_NAME": self.env_name,
            "PYTHON": str(self.prefix / "bin" / "python"),
            "MENU_DIR": str(self.prefix / "Menu"),
            "BIN_DIR": str(self.prefix / "bin"),
            "PY_VER": "N.A",
            "HOME": os.path.expanduser("~"),
            "ICON_EXT": "png",
        }

But the default value of PY_VER is probably never updated (correctly). At least not in the part of
./platforms/win.py that I have checked

    def placeholders(self) -> Dict[str, str]:
        placeholders = super().placeholders
        placeholders.update(
            {
                "SCRIPTS_DIR": str(self.prefix / "Scripts"),
                "PYTHON": str(self.prefix / "python.exe"),
                "PYTHONW": str(self.prefix / "pythonw.exe"),
                "BASE_PYTHON": str(self.base_prefix / "python.exe"),
                "BASE_PYTHONW": str(self.base_prefix / "pythonw.exe"),
                "BIN_DIR": str(self.prefix / "Library" / "bin"),
                "SP_DIR": str(self._site_packages()),
                "ICON_EXT": "ico",
            }

It's quite possible I have not checked the right places, but this looks like a possible explanation

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.0                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.0               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

I have no idea if other variables or platforms have problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant