Skip to content

path: version does not work reliably (asdf v0.16) #207

@jacktose

Description

@jacktose

Provide environment information

OS:
Linux ad-user-ads-11.s.xx.xxx 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
0.16.7

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/usr/lusers/jacktose/.asdf
ASDF_CONFIG_FILE=/usr/lusers/jacktose/.asdfrc

ASDF INSTALLED PLUGINS:
python    https://github.com/danhper/asdf-python.git 5e277e24ec2b6739728f458c1c25eeb2a8b8bb79

To Reproduce

  1. Have a non-asdf python installation:
    $ /netops/local/python-3.9.2/bin/python3.9 -V
    Python 3.9.2
    
  2. Configure asdf to use it, with path: syntax:
    $ asdf set python path:/netops/local/python-3.9.2
    $ cat .tool-versions
    python path:/netops/local/python-3.9.2
    $ asdf current python
    Name            Version                         Source                                      Installed
    python          path:/netops/local/python-3.9.2 /usr/lusers/jacktose/code/l2/.tool-versions true
    
  3. Check which python is used:
    $ asdf which python
    No python executable found for python path:/netops/local/python-3.9.2
    $ python -V
    No executable python found for current version. Please select a different version or install python manually for the current version
    
  4. Compare to python3:
    $ asdf which python3
    /netops/local/python-3.9.2/bin/python3
    $ python3 -V
    Python 3.9.2
    
  5. Try path: with asdf-installed fallback version:
    $ asdf set python path:/netops/local/python-3.9.2 3.9.15
    $ asdf current python
    Name            Version                                Source                                      Installed
    python          path:/netops/local/python-3.9.2 3.9.15 /usr/lusers/jacktose/code/l2/.tool-versions true
    
    $ asdf which python
    /usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python
    $ python -V
    Python 3.9.15
    
    $ asdf which python3
    /usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python3
    $ python3 -V
    Python 3.9.15
    

Note that shims are fine:

$ which python
~/.asdf/shims/python
$ which python3
~/.asdf/shims/python3

And both shims work as expected for asdf-installed python:

$ asdf set python 3.9.15
$ asdf current python
Name            Version         Source                                      Installed
python          3.9.15          /usr/lusers/jacktose/code/l2/.tool-versions true

$ asdf which python
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python
$ python -V
Python 3.9.15

$ asdf which python3
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python3
$ python3 -V
Python 3.9.15

Describe the Bug

path: version is ignored, unless it is the only version listed and you use the python3 shim.

asdf set python ... expected python -V python3 -V
3.9.15 3.9.15 3.9.15 3.9.15
path:/netops/local/python-3.9.2 3.9.2 error ❌ 3.9.2
path:/netops/local/python-3.9.2 3.9.15 3.9.2 3.9.15 3.9.15

Expected Behaviour

path: versions (assuming there's a valid python there) should work with both python & python3 shims, and follow normal precedence rules. See “expected” column above.

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