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

Commit 94b816d

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 94b816d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,26 @@ def tox_get_python_executable(envconfig):
8585
if pipe.poll() == 0:
8686
return out.strip()
8787
else:
88+
# ####################
89+
known_versions = subprocess.check_output(
90+
[pyenv, 'versions'],
91+
universal_newlines=True
92+
).split(os.linesep)
93+
known_versions = [v.strip() for v in known_versions if v.strip()]
94+
import ntpath
95+
desired_version = ntpath.basename(envconfig.basepython)
96+
# or
97+
desired_version = '.'.join(
98+
[str(_v)
99+
for _v in envconfig.python_info.version_info[0:3]]
100+
)
101+
# do shit with desired version
102+
if desired_version in known_versions:
103+
pass
104+
# pyenv install desired_versions
105+
106+
# ####################
107+
88108
if not envconfig.tox_pyenv_fallback:
89109
raise PyenvWhichFailed(err)
90110
LOG.debug("`%s` failed thru tox-pyenv plugin, falling back. "

0 commit comments

Comments
 (0)