From 50399935c986b2c26f4f201d31332009785da8c8 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 16 Dec 2018 19:15:53 +0100 Subject: [PATCH] Revert "Get rid of the fancy magic of preinstalling Python versions" This reverts commit b561d1fc17b12f3dffb818f7e1df5bdbfcd30658. --- .travis.yml | 19 +++++++++++++++---- travis_install.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100755 travis_install.sh diff --git a/.travis.yml b/.travis.yml index 31f81c33..5a34e0d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: python +sudo: true python: - 2.7 - 3.4 @@ -13,27 +14,37 @@ env: - JEDI_TEST_ENVIRONMENT=36 - JEDI_TEST_ENVIRONMENT=37 +addons: + apt: + packages: + # Required to properly create a virtual environment with system Python 3.4. + - python3.4-venv + matrix: allow_failures: - python: pypy - env: TOXENV=sith - include: - python: 3.6 env: - TOXENV=cov - JEDI_TEST_ENVIRONMENT=36 - - python: 3.6 env: TOXENV=sith - # For now ignore pypy, there are so many issues that we don't really need # to run it. #- python: pypy - - python: "nightly" env: - JEDI_TEST_ENVIRONMENT=36 +before_install: + - ./travis_install.sh + # Need to add the path to the Python versions in the end. This might add + # something twice, but it doesn't really matter, because they are appended. + - export PATH=$PATH:/opt/python/3.5/bin + # 3.6 was not installed manually, but already is on the system. However + # it's not on path (unless 3.6 is selected). + - export PATH=$PATH:/opt/python/3.6/bin install: - pip install --quiet tox-travis script: diff --git a/travis_install.sh b/travis_install.sh new file mode 100755 index 00000000..2c5eb944 --- /dev/null +++ b/travis_install.sh @@ -0,0 +1,33 @@ +#! /usr/bin/env bash +set -e + +# 3.6 is already installed on Travis but not as root. This is problematic for +# our virtualenv tests because we require the Python used to create a virtual +# environment to be owned by root (or to be in a safe location which is not the +# case here). +sudo chown root: /opt/python/3.6/bin/python +sudo chown root: /opt/python/3.6.3/bin/python + +if [[ $JEDI_TEST_ENVIRONMENT == "35" ]]; then + VERSION=3.5 + DOWNLOAD=1 +fi + +if [[ -z $VERSION ]]; then + echo "Environments should already be installed" + exit 0 +fi + +PYTHON=python-$VERSION + +# Check if the desired Python version already exists. +$PYTHON --version && exit 0 || true + +if [[ $DOWNLOAD == 1 ]]; then + # Otherwise download and install. + DOWNLOAD_NAME=python-$VERSION + wget https://s3.amazonaws.com/travis-python-archives/binaries/ubuntu/14.04/x86_64/$DOWNLOAD_NAME.tar.bz2 + sudo tar xjf $DOWNLOAD_NAME.tar.bz2 --directory / +fi + +echo "Successfully installed environment."