Summary
pyenv works fine when an explicit python- prefix is added to the Python version when full versions are specified (for example python-3.12.6), however, fails to find a matching Python version if the "auto-resolve latest version" feature is used with a python- prefix (such as python-3.12).
ie:
- Works:
3.12, 3.12.6, python-3.12.6
- Doesn't work:
python-3.12
This appears to be due to the python- prefix removal here only covering the exact match case, and not the pyenv-latest code-path:
|
for version in ${PYENV_VERSION}; do |
|
if version_exists "$version" || [ "$version" = "system" ]; then |
|
versions=("${versions[@]}" "${version}") |
|
elif version_exists "${version#python-}"; then |
|
versions=("${versions[@]}" "${version#python-}") |
|
elif resolved_version="$(pyenv-latest -b "$version")"; then |
|
versions=("${versions[@]}" "${resolved_version}") |
|
else |
|
echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2 |
|
any_not_installed=1 |
|
fi |
|
done |
I will open a PR for this.
Prerequisite
Description
pyenv install 3.12.6
mkdir pyenv-test && cd $_
echo 'python-3.12' > .python-version
pyenv versions
Expected
$ pyenv versions
system
* 3.12.6 (set by /Users/emorley/src/pyenv-test/.python-version)
ie: The same as if I had instead saved either 3.12 or python-3.12.6 into the .python-version file (both of which work fine, unlike python-3.12).
Actual
$ pyenv versions
pyenv: version `python-3.12' is not installed (set by /Users/emorley/src/pyenv-test/.python-version)
system
3.12.6
Trace: trace.log
Though as mentioned above, the cause seems clear and I'm happy to open a PR for this :-)
Summary
pyenv works fine when an explicit
python-prefix is added to the Python version when full versions are specified (for examplepython-3.12.6), however, fails to find a matching Python version if the "auto-resolve latest version" feature is used with apython-prefix (such aspython-3.12).ie:
3.12,3.12.6,python-3.12.6python-3.12This appears to be due to the
python-prefix removal here only covering the exact match case, and not thepyenv-latestcode-path:pyenv/libexec/pyenv-version-name
Lines 32 to 43 in 1cabb6e
I will open a PR for this.
Prerequisite
pyenvand the defaultpython-buildplugin only. Please refrain from reporting issues of other plugins here.Description
env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.logand attachtrace.log. E.g. if you have a problem with installing Python, runenv PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log(note the-voption topyenv install).pyenv install 3.12.6mkdir pyenv-test && cd $_echo 'python-3.12' > .python-versionpyenv versionsExpected
ie: The same as if I had instead saved either
3.12orpython-3.12.6into the.python-versionfile (both of which work fine, unlikepython-3.12).Actual
Trace: trace.log
Though as mentioned above, the cause seems clear and I'm happy to open a PR for this :-)