Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
dont fail if the version is available
Browse files Browse the repository at this point in the history
If the python version is shown by `pyenv versions`, use
`pyenv install` to install the version and retry the operation.

Fixes #3
  • Loading branch information
stavxyz committed Apr 7, 2016
1 parent da8f215 commit 94b816d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ dependencies:
- pip install -U pip
- pip install -U ipdb
- pip install -U tox
- pip install -U .
- pyenv local $TOX_PY35 $TOX_PY34 $TOX_PY33 $TOX_PY32 $TOX_PY27 $TOX_PY26 $TOX_PYPY
- pip install -U -e .

test:
override:
Expand Down
20 changes: 20 additions & 0 deletions tox_pyenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ def tox_get_python_executable(envconfig):
if pipe.poll() == 0:
return out.strip()
else:
# ####################
known_versions = subprocess.check_output(
[pyenv, 'versions'],
universal_newlines=True
).split(os.linesep)
known_versions = [v.strip() for v in known_versions if v.strip()]
import ntpath
desired_version = ntpath.basename(envconfig.basepython)
# or
desired_version = '.'.join(
[str(_v)
for _v in envconfig.python_info.version_info[0:3]]
)
# do shit with desired version
if desired_version in known_versions:
pass
# pyenv install desired_versions

# ####################

if not envconfig.tox_pyenv_fallback:
raise PyenvWhichFailed(err)
LOG.debug("`%s` failed thru tox-pyenv plugin, falling back. "
Expand Down

0 comments on commit 94b816d

Please sign in to comment.