Skip to content

Commit e201af4

Browse files
authored
Merge pull request #59 from altendky/pyenv_for_tox_tool_python
use cached pyenv to get python 3.8.1 for tool envs on travis
2 parents e811f33 + 112e427 commit e201af4

File tree

3 files changed

+47
-16
lines changed

3 files changed

+47
-16
lines changed

.travis.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,43 @@ branches:
66
# 'v' followed by a digit, such as for version tags.
77
- master
88
- /^v\d.*$/
9-
cache: pip
9+
cache:
10+
pip: true
11+
directories:
12+
# pyenv is used to provide the Python version used for tool targets
13+
# that version is specified below in env: global: TOXTOOLPYTHONVERSION
14+
- $TRAVIS_BUILD_DIR/.pyenv
15+
addons:
16+
apt:
17+
packages:
18+
# The below packages are copied from the pyenv wiki suggestions for
19+
# Ubuntu as of January 2020
20+
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
21+
- make
22+
- build-essential
23+
- libssl-dev
24+
- zlib1g-dev
25+
- libbz2-dev
26+
- libreadline-dev
27+
- libsqlite3-dev
28+
- wget
29+
- curl
30+
- llvm
31+
- libncurses5-dev
32+
- libncursesw5-dev
33+
- xz-utils
34+
- tk-dev
35+
- libffi-dev
36+
- liblzma-dev
37+
- python-openssl
38+
- git
1039
env:
1140
global:
1241
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
1342
- SEGFAULT_SIGNALS=all
43+
- DESERT_PYENV_ROOT=$TRAVIS_BUILD_DIR/.pyenv
44+
- TOXTOOLPYTHONVERSION=3.8.1
45+
- TOXTOOLPYTHON=${DESERT_PYENV_ROOT}/versions/${TOXTOOLPYTHONVERSION}/bin/python
1446
jobs:
1547
include:
1648
- python: '3.6'
@@ -33,23 +65,23 @@ before_install:
3365
- uname -a
3466
- lsb_release -a
3567
install:
68+
- |
69+
(
70+
# Usage of a subshell is intentional to avoid the PYENV_ROOT living
71+
# on. Travis uses their own PYENV_ROOT and changing that causes
72+
# tox trouble finding the Python to be used for testing.
73+
if [[ ! -f ${TOXTOOLPYTHON} ]]; then
74+
export PYENV_ROOT="${DESERT_PYENV_ROOT}"
75+
rm -rf "${PYENV_ROOT}"
76+
curl https://pyenv.run | bash
77+
"${PYENV_ROOT}/bin/pyenv" install 3.8.1
78+
fi
79+
)
3680
- pip install tox
3781
- virtualenv --version
3882
- easy_install --version
3983
- pip --version
4084
- tox --version
41-
- |
42-
set -ex
43-
if [[ $TRAVIS_PYTHON_VERSION == 'pypy3' ]]; then
44-
(cd $HOME
45-
wget https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.1.1-linux64.tar.bz2
46-
tar xf pypy3*.tar.bz2
47-
pypy3*/bin/pypy3 -m ensurepip
48-
pypy3*/bin/pypy3 -m pip install -U virtualenv)
49-
export PATH=$(echo $HOME/pypy3*/bin):$PATH
50-
export TOXPYTHON=$(echo $HOME/pypy3*/bin/pypy3)
51-
fi
52-
set +x starting
5385
- |
5486
set -ex
5587
if [[ $TOXENV == 'check' ]]; then

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ exclude = '''
4040
| \.hg
4141
| \.mypy_cache
4242
| \.tox
43+
| \.pyenv
4344
| \.?venv
4445
| _build
4546
| buck-out

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ envlist =
1111
[testenv]
1212
basepython =
1313
pypy3: {env:TOXPYTHON:pypy3}
14-
{doc,spell}: {env:TOXPYTHON:python3.8}
1514
py36: {env:TOXPYTHON:python3.6}
1615
py37: {env:TOXPYTHON:python3.7}
1716
py38: {env:TOXPYTHON:python3.8}
18-
{bootstrap,clean,check,report,codecov}: {env:TOXPYTHON:python3}
17+
{doc,spell,bootstrap,clean,check,report,codecov}: {env:TOXTOOLPYTHON:python3.8}
1918
setenv =
2019
PYTHONPATH={toxinidir}/tests
2120
PYTHONUNBUFFERED=yes
@@ -56,7 +55,6 @@ deps =
5655
pyenchant
5756

5857
[testenv:doc]
59-
basepython=python3.8
6058
deps =
6159
-r{toxinidir}/docs/requirements.txt
6260

0 commit comments

Comments
 (0)