WIP: dont fail if the version is available
If the python version is shown by pyenv versions, and we
can reasonably figure out the correct version to use (esp. if
it matches the name exactly), enable the version with the
PYENV_VERSION environment variable, and try again
to find the path to the executable using pyenv which.
With this change, we are resilient to errors like the one
below which is seen when running pyenv which. We
simply choose the latest version of python2.6 (for example)
that is available (according to pyenv versions),
set it (using $PYENV_VERSION), and try again. Again, by
doing this we can usually avoid the following error:
$ pyenv which python2.6
pyenv: python2.6: command not found
The `python2.6' command exists in these Python versions:
2.6.6
2.6.8
In this case, tox-pyenv sets PYENV_VERSION to 2.6.8
(the latest version that most closely matches) and retries the operation.
We already know the retry will succeed because we saw 2.6.8
in the output from pyenv versions.
This behavior may not be desirable for some, and probably needs a flag to turn on/off.
Fixes #3
todo
- [ ] add flag to toggle this behavior, default to "on"
:dancer:
@blueyed I put this PR together based on this discussion:
https://github.com/yyuu/pyenv/issues/92#issuecomment-145381577
If you have time, I would appreciate a pair of :eyes: