Skip to content

Commit

Permalink
Fix installation to make every Travis CI job pass
Browse files Browse the repository at this point in the history
- Replace Python 3.7 by 3.7-dev since 3.7 doesn't exist on Travis CI
  (though [1] states that 3.7, 3.7-dev, 3.8-dev and nightly don't work
   on Trusty because of its old OpenSSL version, the 3.7 doesn't exist
   and 3.7-dev seem to be the same to nightly)
- Fix the broken pip on Python 2.6 and 3.2 from Travis CI,
  installing it (as well as wheel and setuptools) with the get-pip.py
  script specific to these Python versions
- Install a newer virtualenv on Python 2.6, since virtualenv 15.1 had
  been forcing an older pip which is broken on this Python version
- List the environment packages installed during the build
- Install an older version of PyYAML on Python 3.2 (actually, PyYAML
  3.13 seem to require Python 2.7 or Python 3.4+, as stated in [2],
  but nothing wrong happened on the tests on Python 2.6/3.3)
- Force Cython < 0.27 on Python 3.2, since it's required to install
  PyYAML from the source distribution

Some of these requirements are Travis-specific, e.g. Cython doesn't
need to be installed on a ubuntu:trusty Docker image that installed
Python 3.2 from the deadsnakes PPA, but it's hard to tell why the CI
environment with the same packages in the same version behaves
differently

[1] https://docs.travis-ci.com/user/languages/python
[2] https://pyyaml.org/wiki/PyYAML
  • Loading branch information
danilobellini committed Aug 28, 2018
1 parent d95bcbd commit f5f9010
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ python:
- 3.4
- 3.5
- 3.6
- 3.7
- 3.7-dev
- pypy
- pypy3

before_install:
- SED_GET_PY='s/[^0-9]//g;s/.//3g;2s/.*/py/;1!G;h;$!d;s/y.2./y/;s/y.3./y3/'
- PY=$(python -V 2>&1 | sed "$SED_GET_PY")
- TOX=tox
- test $PY != 32 || TOX='virtualenv<14 tox<3'
- test $PY != 33 -a $PY != 26 || TOX='virtualenv<15.2 tox<3'
- export TOXENV=py$PY
# On Travis CI environments for Python 2.6 and 3.2, pip is broken
- GET_PIP_URL=https://bootstrap.pypa.io/${PY::1}.${PY:1}/get-pip.py
- if [[ "26 32" =~ $PY ]] ; then python <(curl -fsSL "$GET_PIP_URL") ; fi
- DEPS_TABLE=([26]='virtualenv<16 tox<3'
[32]='virtualenv<14 tox<3'
[33]='virtualenv<15.2 tox<3')
- DEPS=${DEPS_TABLE[$PY]:-'tox'}

install:
- pip install $TOX
- pip install --upgrade $DEPS
- pip list # Helpful when debugging
- tox --notest

script:
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ def run_tests(self):
if sys.version_info < (2, 7, 0):
tests_require.append('unittest2')

install_requires = ['PyYAML >=3.10', 'argh >=0.24.1', 'pathtools >=0.1.1']
install_requires = [
"PyYAML<3.13" if sys.version_info[:2] == (3, 2) else "PyYAML>=3.10",
"argh>=0.24.1",
"pathtools>=0.1.1",
]
if sys.version_info < (2, 7, 0):
# argparse is merged into Python 2.7 in the Python 2x series
# and Python 3.2 in the Python 3x series.
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ deps = pytest-cov
py32: coverage<4
py{33,26}: pytest<3.3
py32: pytest<3
; Cython is required in order to install PyYAML from source
py32: cython<0.27
commands = py.test {posargs}

[pytest]
Expand Down

0 comments on commit f5f9010

Please sign in to comment.