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

Commit 341e068

Browse files
committed
dont fail if the version is available
If the python version is shown by `pyenv versions`, use `pyenv install` to install the version and retry the operation. Fixes #3
1 parent da8f215 commit 341e068

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

circle.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ dependencies:
1717
- pip install -U pip
1818
- pip install -U ipdb
1919
- pip install -U tox
20-
- pip install -U .
21-
- pyenv local $TOX_PY35 $TOX_PY34 $TOX_PY33 $TOX_PY32 $TOX_PY27 $TOX_PY26 $TOX_PYPY
20+
- pip install -U -e .
2221

2322
test:
2423
override:

tox_pyenv.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def tox_get_python_executable(envconfig):
4242

4343

4444
import logging
45+
import os
4546
import subprocess
4647

4748
import py
@@ -85,6 +86,26 @@ def tox_get_python_executable(envconfig):
8586
if pipe.poll() == 0:
8687
return out.strip()
8788
else:
89+
# ####################
90+
known_versions = subprocess.check_output(
91+
[pyenv, 'versions'],
92+
universal_newlines=True
93+
).split(os.linesep)
94+
known_versions = [v.strip() for v in known_versions if v.strip()]
95+
import ntpath
96+
desired_version = ntpath.basename(envconfig.basepython)
97+
# or
98+
desired_version = '.'.join(
99+
[str(_v)
100+
for _v in envconfig.python_info.version_info[0:3]]
101+
)
102+
# do shit with desired version
103+
if desired_version in known_versions:
104+
pass
105+
# pyenv install desired_versions
106+
107+
# ####################
108+
88109
if not envconfig.tox_pyenv_fallback:
89110
raise PyenvWhichFailed(err)
90111
LOG.debug("`%s` failed thru tox-pyenv plugin, falling back. "

0 commit comments

Comments
 (0)