From 137825d2fe9bed03b00689fbb7617927e898f867 Mon Sep 17 00:00:00 2001 From: jthomale Date: Wed, 8 Feb 2017 16:19:45 -0600 Subject: [PATCH 01/21] Add caching of full Python builds Caching an entire Python build is more efficient than only caching the downloaded file (which is what PYTHON_BUILD_CACHE_PATH does). Once a Python build is installed via the "pyenv install" command, this moves the entire build to the Travis cache directory (e.g. ~/.pyenv_cache) and links to it in ./pyenv/versions. Once it's cached, future Travis builds can simply link to the cached version without having to re-download or re-build it. --- setup-pyenv.sh | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 36a6127..62f0bb4 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -10,8 +10,8 @@ # Directory in which to install pyenv [default: ~/.pyenv] # - PYENV_RELEASE # Release tag of pyenv to download [default: clone from master] -# - PYTHON_BUILD_CACHE_PATH: -# Directory in which to cache PyPy builds [default: ~/.pyenv_cache] +# - PYENV_CACHE_PATH +# Directory where full Python builds are cached (i.e., for Travis) if [[ -z "$PYENV_VERSION" ]]; then echo "\$PYENV_VERSION is not set. Not installing a pyenv." @@ -37,15 +37,43 @@ export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" # Make sure the cache directory exists -PYTHON_BUILD_CACHE_PATH="${PYTHON_BUILD_CACHE_PATH:-$HOME/.pyenv_cache}" -mkdir -p "$PYTHON_BUILD_CACHE_PATH" +PYENV_CACHE_PATH="${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" +mkdir -p "$PYENV_CACHE_PATH" -# Install the pyenv -pyenv install "$PYENV_VERSION" + +VERSION_CACHE_PATH="$PYENV_CACHE_PATH/$PYENV_VERSION" +VERSION_PYENV_PATH="$PYENV_ROOT/versions/$PYENV_VERSION" +# Check to see if this PYENV_VERSION is in the cache +if [[ ! -d "$VERSION_CACHE_PATH" ]]; then + # If not, use pyenv to download and build from scratch, then move to cache + echo "$PYENV_VERSION not found in cache" + pyenv install "$PYENV_VERSION" + mv "$VERSION_PYENV_PATH" "$PYENV_CACHE_PATH" +fi +# Create a link in .pyenv/versions to the cached version build +ln -s "$VERSION_CACHE_PATH" "$VERSION_PYENV_PATH" +echo "PYENV_CACHE_PATH" +ls "$PYENV_CACHE_PATH/" +echo "VERSION_CACHE_PATH" +ls "$VERSION_CACHE_PATH/" +echo "PYENV_ROOT/versions" +ls "$PYENV_ROOT/versions/" +echo "PYENV_ROOT/versions/PYENV_VERSION" +ls "$PYENV_ROOT/versions/$PYENV_VERSION/" +echo "pyenv versions" +pyenv versions +eval "$(pyenv init -)" pyenv global "$PYENV_VERSION" +which python +which pip +pyenv which python +pyenv which pip + +# Make sure virtualenv is installed and up-to-date... +pip install -U virtualenv -# Make and source a new virtualenv -VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_PYTHON" +# Then make and source a new virtualenv +VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_VERSION" virtualenv -p "$(which python)" "$VIRTUAL_ENV" source "$VIRTUAL_ENV/bin/activate" From 2a508461fbfbfb79a0055ce3d160d17fd450d56a Mon Sep 17 00:00:00 2001 From: jthomale Date: Thu, 9 Feb 2017 10:35:39 -0600 Subject: [PATCH 02/21] Resolve issue with cached Python not activating When running Travis tests using a previously cached Python, calls to `pyenv global $PYENV_VERSION` were not activating the environment. I think, since in this case the PYENV_VERSION was not actually being installed with `pyenv install` and rather linked to an existing directory, the necessary shim wasn't being created. Running `pyenv init` after creating the link to the version fixed the issue. --- setup-pyenv.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 62f0bb4..6e63bf0 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -52,22 +52,12 @@ if [[ ! -d "$VERSION_CACHE_PATH" ]]; then fi # Create a link in .pyenv/versions to the cached version build ln -s "$VERSION_CACHE_PATH" "$VERSION_PYENV_PATH" -echo "PYENV_CACHE_PATH" -ls "$PYENV_CACHE_PATH/" -echo "VERSION_CACHE_PATH" -ls "$VERSION_CACHE_PATH/" -echo "PYENV_ROOT/versions" -ls "$PYENV_ROOT/versions/" -echo "PYENV_ROOT/versions/PYENV_VERSION" -ls "$PYENV_ROOT/versions/$PYENV_VERSION/" -echo "pyenv versions" -pyenv versions +# Reinitialize pyenv--if we skipped `pyenv install` and are using a previously +# cached version, then we need the shims etc. to be created so the pyenv will +# activate correctly. eval "$(pyenv init -)" pyenv global "$PYENV_VERSION" -which python -which pip -pyenv which python -pyenv which pip + # Make sure virtualenv is installed and up-to-date... pip install -U virtualenv From 3d1743a2005f0bf39f3b46887fdc02d506e6441c Mon Sep 17 00:00:00 2001 From: jthomale Date: Wed, 8 Feb 2017 16:41:27 -0600 Subject: [PATCH 03/21] Bring travis.yml up-to-date with changes This updates CACHE env variables based on changes to setup-pyenv.sh, adds a test build for a CPython version, and makes a few other minor modifications. --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index a96c324..640c460 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,14 @@ env: - SETUP_SCRIPT=setup-pyenv.sh matrix: include: - # Without PyPy + # Normal method of specifying Python version - python: '2.7' - # Basic options - - python: pypy - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' - # Custom options - - python: pypy - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache + # Use PYENV_VERSION with CPython, specific major.minor.change version + - env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' + # Use PYENV_VERSION with PyPy + - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' + # Use PYENV_VERSION with PyPy and Custom options + - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYENV_CACHE_PATH=$HOME/.pyenv-pypy-cache # Legacy setup-pypy.sh - python: pypy env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh @@ -19,7 +19,7 @@ matrix: cache: - pip - directories: - - $HOME/.pyenv_cache + - "${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" script: - source $SETUP_SCRIPT From 1d97579dbc1a382361b15302867f0966f39d7707 Mon Sep 17 00:00:00 2001 From: jthomale Date: Thu, 9 Feb 2017 10:02:25 -0600 Subject: [PATCH 04/21] Update README based on chages to setup-pyenv.sh --- README.md | 27 ++++++++++++--------------- setup-pyenv.sh | 9 ++++----- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 228e931..7ecbc50 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,11 @@ # travis-pyenv -Set up [pyenv](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org) builds. - -Setting up pyenv properly in a Travis CI build environment can be quite tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) that makes this process much simpler. - -A common use case for this is to install an up-to-date version of [PyPy](http://pypy.org). The Travis CI build images currently contain a very old version of PyPy which breaks some common Python modules. +With [Travis CI](https://travis-ci.org), sometimes you want to test your project code using an unsupported Python build, such as an exact version of [CPython](http://www.python.org), a more recent version of [PyPy](http://pypy.org), or any number of other Python implementations. You can use [pyenv](https://github.com/yyuu/pyenv) to install a very specific Python version or distribution, but setting it up properly in a Travis CI build environment can be tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) you can download and call in your `.travis.yml` configuration to simplify this process. ## Usage -1. Set the `$PYENV_VERSION` environment variable to the Python to install. -2. Tell Travis to cache the `$HOME/.pyenv_cache` directory. +1. Instead of setting a value for `python` in your `.travis.yml` build matrix, use the `$PYENV_VERSION` environment variable to set the pyenv Python version you want to use for a given build. +2. Tell Travis to cache the `$HOME/.pyenv_cache` directory OR (optionally) some other directory you specify in the `$PYENV_CACHE_PATH` environment variable. 3. Download and source the script in `before_install`. +4. Build your project and run your tests as usual. There are a few install options that can be set via environment variables: * `PYENV_VERSION` @@ -19,8 +16,8 @@ There are a few install options that can be set via environment variables: Directory in which to install pyenv [default: `~/.pyenv`] * `PYENV_RELEASE` Release tag of pyenv to download [default: clone from master] -* `PYTHON_BUILD_CACHE_PATH` - Directory in which to cache PyPy builds [default: `~/.pyenv_cache`] +* `PYENV_CACHE_PATH` + Directory in which to cache pyenv's Python builds [default: `~/.pyenv_cache`] ### Example `travis.yml` @@ -28,19 +25,18 @@ There are a few install options that can be set via environment variables: language: python matrix: include: - - python: '2.7' + - env: PYENV_VERSION='2.7.13' PYENV_VERSION_STRING='Python 2.7.13' - python: '3.5' - - python: pypy - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' + - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' cache: - pip - directories: - - ~/.pyenv_cache + - $HOME/.pyenv_cache before_install: - | if [[ -n "$PYENV_VERSION" ]]; then - wget https://github.com/praekeltfoundation/travis-pyenv/releases/download/0.2.0/setup-pyenv.sh + wget https://github.com/jthomale/travis-pyenv/raw/develop/setup-pyenv.sh source setup-pyenv.sh fi @@ -50,4 +46,5 @@ script: ## Notes * Installing pyenv by downloading a release tag rather than cloning the git repo can make your builds a bit faster in some cases. Set the `PYENV_RELEASE` environment variable to achieve that. -* pyenv fails to install properly if `~/.pyenv` is present, even if the directory is empty. So if you cache any directories within `~/.pyenv` then you will probably break pyenv. +* If you want to use `$PYENV_CACHE_PATH`, you must also set up Travis to cache this directory in your Travis configuration. Using the cache is optional, but it can greatly speed up subsequent builds. +* pyenv fails to install properly if the `$PYENV_ROOT` is already present, even if the directory is empty. So if you set Travis to cache any directories within the pyenv root, then you will probably break pyenv. That's why Python builds are cached outside the pyenv root and then linked after pyenv is installed. diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 6e63bf0..d8e95bd 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -40,17 +40,17 @@ eval "$(pyenv init -)" PYENV_CACHE_PATH="${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" mkdir -p "$PYENV_CACHE_PATH" - +# Check to see if this PYENV_VERSION is in the cache; if not, use pyenv to +# download and build from scratch, then move to cache VERSION_CACHE_PATH="$PYENV_CACHE_PATH/$PYENV_VERSION" VERSION_PYENV_PATH="$PYENV_ROOT/versions/$PYENV_VERSION" -# Check to see if this PYENV_VERSION is in the cache if [[ ! -d "$VERSION_CACHE_PATH" ]]; then - # If not, use pyenv to download and build from scratch, then move to cache echo "$PYENV_VERSION not found in cache" pyenv install "$PYENV_VERSION" mv "$VERSION_PYENV_PATH" "$PYENV_CACHE_PATH" fi -# Create a link in .pyenv/versions to the cached version build + +# Create a link in $PYENV_ROOT/versions to the cached version build ln -s "$VERSION_CACHE_PATH" "$VERSION_PYENV_PATH" # Reinitialize pyenv--if we skipped `pyenv install` and are using a previously # cached version, then we need the shims etc. to be created so the pyenv will @@ -58,7 +58,6 @@ ln -s "$VERSION_CACHE_PATH" "$VERSION_PYENV_PATH" eval "$(pyenv init -)" pyenv global "$PYENV_VERSION" - # Make sure virtualenv is installed and up-to-date... pip install -U virtualenv From 71c2608190cff563df8cfc93abf235f06a15a28c Mon Sep 17 00:00:00 2001 From: jthomale Date: Thu, 9 Feb 2017 11:42:09 -0600 Subject: [PATCH 05/21] Update README to fix URL in travis.yml example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ecbc50..5493e42 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ cache: before_install: - | if [[ -n "$PYENV_VERSION" ]]; then - wget https://github.com/jthomale/travis-pyenv/raw/develop/setup-pyenv.sh + wget https://github.com/jthomale/travis-pyenv/raw/fullbuild/setup-pyenv.sh source setup-pyenv.sh fi From 6e5bd6932b6b84b7602b7cdebded9604ed60d52c Mon Sep 17 00:00:00 2001 From: jthomale Date: Fri, 10 Feb 2017 11:19:07 -0600 Subject: [PATCH 06/21] Update README with small tweaks --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5493e42..d2ca7f4 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ With [Travis CI](https://travis-ci.org), sometimes you want to test your project code using an unsupported Python build, such as an exact version of [CPython](http://www.python.org), a more recent version of [PyPy](http://pypy.org), or any number of other Python implementations. You can use [pyenv](https://github.com/yyuu/pyenv) to install a very specific Python version or distribution, but setting it up properly in a Travis CI build environment can be tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) you can download and call in your `.travis.yml` configuration to simplify this process. ## Usage -1. Instead of setting a value for `python` in your `.travis.yml` build matrix, use the `$PYENV_VERSION` environment variable to set the pyenv Python version you want to use for a given build. +1. In your `.travis.yml` file, to run tests against non-Travis versions of Python, use the `$PYENV_VERSION` environment variable to set the pyenv Python version. (You can also set an appropriate value for `python`, as you normally would, for jobs where you want to continue running tests against Python versions that are already supported by Travis.) 2. Tell Travis to cache the `$HOME/.pyenv_cache` directory OR (optionally) some other directory you specify in the `$PYENV_CACHE_PATH` environment variable. -3. Download and source the script in `before_install`. +3. Download and source the `setup-pyenv.sh` script in `before_install`. 4. Build your project and run your tests as usual. There are a few install options that can be set via environment variables: @@ -47,4 +47,4 @@ script: ## Notes * Installing pyenv by downloading a release tag rather than cloning the git repo can make your builds a bit faster in some cases. Set the `PYENV_RELEASE` environment variable to achieve that. * If you want to use `$PYENV_CACHE_PATH`, you must also set up Travis to cache this directory in your Travis configuration. Using the cache is optional, but it can greatly speed up subsequent builds. -* pyenv fails to install properly if the `$PYENV_ROOT` is already present, even if the directory is empty. So if you set Travis to cache any directories within the pyenv root, then you will probably break pyenv. That's why Python builds are cached outside the pyenv root and then linked after pyenv is installed. +* pyenv fails to install properly if the `$PYENV_ROOT` is already present, even if the directory is empty. So if you set Travis to cache any directories within the pyenv root, then you will probably break pyenv. For this reason, Python builds are cached outside the pyenv root and then linked after pyenv is installed. From 5dba96b8f5872dbb1642242db49dbc221db83bb6 Mon Sep 17 00:00:00 2001 From: jthomale Date: Mon, 13 Feb 2017 15:26:32 -0600 Subject: [PATCH 07/21] Verify build thoroughly before committing to cache This change attempts to address a problem where a corrupt or otherwise non-functioning Python build could be saved in the Travis CI cache. If a Python build fails (e.g., the "pyenv install" command exits with status code "1"), then the setup-pyenv.sh script exits with status code "1." Also, before a cached Python is used, it gets verified. If it can't be verified, it's cleared out of the cache and a new build is installed. --- setup-pyenv.sh | 54 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index d8e95bd..b8b4f1e 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -13,6 +13,20 @@ # - PYENV_CACHE_PATH # Directory where full Python builds are cached (i.e., for Travis) +# Function: verify_python -- attempts to call the Python command supplied in +# the first argument with the --version flag. If PYENV_VERSION_STRING is set, +# then it validates the returned version string as well (via fgrep). Returns +# whatever status code the command returns. +verify_python() { + local python_bin="$1" + + if [[ -n "$PYENV_VERSION_STRING" ]]; then + "$python_bin" --version 2>&1 | fgrep "$PYENV_VERSION_STRING" &>/dev/null + else + "$python_bin" --version &>/dev/null + fi +} + if [[ -z "$PYENV_VERSION" ]]; then echo "\$PYENV_VERSION is not set. Not installing a pyenv." return 0 @@ -40,18 +54,32 @@ eval "$(pyenv init -)" PYENV_CACHE_PATH="${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" mkdir -p "$PYENV_CACHE_PATH" -# Check to see if this PYENV_VERSION is in the cache; if not, use pyenv to -# download and build from scratch, then move to cache -VERSION_CACHE_PATH="$PYENV_CACHE_PATH/$PYENV_VERSION" -VERSION_PYENV_PATH="$PYENV_ROOT/versions/$PYENV_VERSION" -if [[ ! -d "$VERSION_CACHE_PATH" ]]; then - echo "$PYENV_VERSION not found in cache" - pyenv install "$PYENV_VERSION" - mv "$VERSION_PYENV_PATH" "$PYENV_CACHE_PATH" +# Verify the PYENV_VERSION in the cache; if it doesn't verify, use pyenv to +# download and build from scratch, then move to cache if the build succeeds +version_cache_path="$PYENV_CACHE_PATH/$PYENV_VERSION" +version_pyenv_path="$PYENV_ROOT/versions/$PYENV_VERSION" +if ! verify_python "$version_cache_path/bin/python"; then + echo "Valid $PYENV_VERSION not found in cache, installing from scratch" + + if pyenv install "$PYENV_VERSION"; then + if verify_python "$version_pyenv_path/bin/python"; then + # Remove an existing (broken) build from the cache if one exists + if [[ -d "$version_cache_path" ]]; then + rm -rf "$version_cache_path" + fi + mv "$version_pyenv_path" "$PYENV_CACHE_PATH" + else + echo "Failed to verify that the pyenv was properly installed." + return 1 + fi + else + echo "pyenv build failed." + return 1 + fi fi # Create a link in $PYENV_ROOT/versions to the cached version build -ln -s "$VERSION_CACHE_PATH" "$VERSION_PYENV_PATH" +ln -s "$version_cache_path" "$version_pyenv_path" # Reinitialize pyenv--if we skipped `pyenv install` and are using a previously # cached version, then we need the shims etc. to be created so the pyenv will # activate correctly. @@ -66,9 +94,7 @@ VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_VERSION" virtualenv -p "$(which python)" "$VIRTUAL_ENV" source "$VIRTUAL_ENV/bin/activate" -if [[ -n "$PYENV_VERSION_STRING" ]]; then - if ! python --version 2>&1 | fgrep "$PYENV_VERSION_STRING"; then - echo "Failed to verify that the pyenv was properly installed." - return 1 - fi +if ! verify_python "python"; then + echo "Failed to verify that the pyenv was properly installed." + return 1 fi From 9f0d327d7efdcc5db558384aa9da2f85afcb23ab Mon Sep 17 00:00:00 2001 From: jthomale Date: Wed, 15 Feb 2017 13:43:00 -0600 Subject: [PATCH 08/21] Improve error handling and reporting The aim of this set of changes is to make the handling and reporting of errors in setup-pyenv.sh as robust as possible. The script now does the following. First it attempts to find and use a valid cached Python. If it can't find the right version in the cache or if the Python build in the cache is invalid, then it tries reinstalling (deleting a broken cached existing version first). If the python build fails for any reason, it immediately returns a status code 1. After a successful reinstall, it tries moving the ~/.pyenv/versions/ directory to the cache directory. If the move fails, it issues a warning but continues anyway. It attempts to validate the newly installed version and returns a status code 1 if that fails. As before, it does one final validation after the virtualenv is created. Messages are now output at each step to make it clearer what's going on in the Travis logs. If a validation step fails, it outputs some debugging information to help with troubleshooting. --- setup-pyenv.sh | 108 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 79 insertions(+), 29 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index b8b4f1e..c34f276 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -13,10 +13,17 @@ # - PYENV_CACHE_PATH # Directory where full Python builds are cached (i.e., for Travis) -# Function: verify_python -- attempts to call the Python command supplied in -# the first argument with the --version flag. If PYENV_VERSION_STRING is set, -# then it validates the returned version string as well (via fgrep). Returns -# whatever status code the command returns. +PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" +PYENV_CACHE_PATH="${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" +version_cache_path="$PYENV_CACHE_PATH/$PYENV_VERSION" +version_pyenv_path="$PYENV_ROOT/versions/$PYENV_VERSION" + +# Functions +# +# verify_python -- attempts to call the Python command or binary +# supplied in the first argument with the --version flag. If +# PYENV_VERSION_STRING is set, then it validates the returned version string +# as well (using fgrep). Returns whatever status code the command returns. verify_python() { local python_bin="$1" @@ -27,8 +34,49 @@ verify_python() { fi } +# use_cached_python -- Tries symlinking to the cached PYENV_VERSION and +# verifying that it's a working build. Returns 0 if it's found and it +# verifies, otherwise returns 1. +use_cached_python() { + if [[ -d "$version_cache_path" ]]; then + printf "Cached python found, $PYENV_VERSION. Verifying..." + ln -s "$version_cache_path" "$version_pyenv_path" + if verify_python "$version_pyenv_path/bin/python"; then + printf "success!\n" + return 0 + else + printf "FAILED.\nClearing cached version..." + rm -f $version_pyenv_path + rm -rf $version_cache_path + printf "done.\n" + return 1 + fi + else + echo "No cached python found." + return 1 + fi +} + +# output_debugging_info -- Outputs useful debugging information +output_debugging_info() { + echo "**** Debugging information" + printf "PYENV_VERSION\n$PYENV_VERSION\n" + printf "PYENV_VERSION_STRING\n$PYENV_VERSION_STRING\n" + printf "PYENV_CACHE_PATH\n$PYENV_CACHE_PATH\n" + echo "python --version" + python --version + echo "$version_cache_path/bin/python --version" + $version_cache_path/bin/python --version + echo "which python" + which python + echo "pyenv which python" + pyenv which python +} + +# Main script begins. + if [[ -z "$PYENV_VERSION" ]]; then - echo "\$PYENV_VERSION is not set. Not installing a pyenv." + echo "PYENV_VERSION is not set. Not installing a pyenv." return 0 fi @@ -36,7 +84,7 @@ fi deactivate # Install pyenv -PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" +echo "**** Installing pyenv." if [[ -n "$PYENV_RELEASE" ]]; then # Fetch the release archive from Github (slightly faster than cloning) mkdir "$PYENV_ROOT" @@ -51,38 +99,36 @@ export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" # Make sure the cache directory exists -PYENV_CACHE_PATH="${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" mkdir -p "$PYENV_CACHE_PATH" -# Verify the PYENV_VERSION in the cache; if it doesn't verify, use pyenv to -# download and build from scratch, then move to cache if the build succeeds -version_cache_path="$PYENV_CACHE_PATH/$PYENV_VERSION" -version_pyenv_path="$PYENV_ROOT/versions/$PYENV_VERSION" -if ! verify_python "$version_cache_path/bin/python"; then - echo "Valid $PYENV_VERSION not found in cache, installing from scratch" - +# Try using an already cached PYENV_VERSION. If it fails or is not found, +# then install from scratch. +echo "**** Trying to find and use cached python $PYENV_VERSION." +if ! use_cached_python; then + echo "**** Installing python $PYENV_VERSION with pyenv now." if pyenv install "$PYENV_VERSION"; then - if verify_python "$version_pyenv_path/bin/python"; then - # Remove an existing (broken) build from the cache if one exists - if [[ -d "$version_cache_path" ]]; then - rm -rf "$version_cache_path" + if mv "$version_pyenv_path" "$PYENV_CACHE_PATH"; then + echo "Python was successfully built and moved to cache." + echo "**** Trying to find and use cached python $PYENV_VERSION." + if ! use_cached_python; then + echo "Python version $PYENV_VERSION was apparently successfully built" + echo "with pyenv, but, once cached, it could not be verified." + output_debugging_info + return 1 fi - mv "$version_pyenv_path" "$PYENV_CACHE_PATH" else - echo "Failed to verify that the pyenv was properly installed." - return 1 + echo "** Warning: Python was succesfully built, but moving to cache" + echo "failed. Proceeding anyway without caching." fi else - echo "pyenv build failed." + echo "Python version $PYENV_VERSION build FAILED." return 1 fi fi -# Create a link in $PYENV_ROOT/versions to the cached version build -ln -s "$version_cache_path" "$version_pyenv_path" -# Reinitialize pyenv--if we skipped `pyenv install` and are using a previously -# cached version, then we need the shims etc. to be created so the pyenv will -# activate correctly. +# Now we have to reinitialize pyenv, as we need the shims etc to be created so +# the pyenv activates correctly. +echo "**** Activating python $PYENV_VERSION and generating new virtualenv." eval "$(pyenv init -)" pyenv global "$PYENV_VERSION" @@ -94,7 +140,11 @@ VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_VERSION" virtualenv -p "$(which python)" "$VIRTUAL_ENV" source "$VIRTUAL_ENV/bin/activate" -if ! verify_python "python"; then - echo "Failed to verify that the pyenv was properly installed." +printf "One final verification that the virtualenv is working..." +if verify_python "python"; then + printf "success!\n" +else + printf "FAILED!\n" + output_debugging_info return 1 fi From b9221ba85a24c9e2c03c58cc6df9d09daae756bc Mon Sep 17 00:00:00 2001 From: Nelson Chen Date: Sat, 18 Mar 2017 22:15:47 -0700 Subject: [PATCH 09/21] Configure TravisCI to test building CPython on macOS These changes remove the global "python:'2.7'" key and adds two new build configurations for macOS. The key removal is necessary to even get TravisCI to start a macOS job and 'travis-pyenv' does not need a TravisCI-provided Python version on the Linux or macOS jobs. The first configuration tests if the bare-basic installation works for Python 3.6.0 on macOS. The second configuration checks if a "--enable-framework" (macOS only) build is able to be built. This second configuration would be useful for PyInstaller builds on macOS. --- .travis.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a96c324..ffe7ad7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -language: python env: global: - SETUP_SCRIPT=setup-pyenv.sh @@ -15,6 +14,20 @@ matrix: # Legacy setup-pypy.sh - python: pypy env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh + # macOS + # Note that the `python` key is *not* set. + # If set, TravisCI will not even start the build and fail since there's + # no Python tarball to download and install on macOS. + # See https://github.com/travis-ci/travis-ci/issues/2312 for details + # So, it shows up as Ruby in TravisCI but as the PYENV_VERSION_STRING check + # can attest, we are still fine. + - os: 'osx' + env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' + # macOS Framework Build + # Useful for PyInstaller + # Example issue: https://github.com/pyenv/pyenv/issues/443 + - os: 'osx' + env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' PYTHON_CONFIGURE_OPTS="--enable-framework" cache: - pip From 5ba4db7b03f9550393ed435545dd59141d39b704 Mon Sep 17 00:00:00 2001 From: jthomale Date: Mon, 20 Mar 2017 10:54:17 -0500 Subject: [PATCH 10/21] Add 'python' version keys back to build matrix As noted in b9221ba, the configuration change to allow Python builds to work on Mac OS X causes Travis-CI to list jobs as Ruby unless a 'python' key is present. My initial PR removed these from the build matrix because I thought they were extraneous. This commit adds them back so that Travis-CI will list the correct Python version on Linux builds. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b88632..aa4299f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,14 @@ matrix: # Normal method of specifying Python version - python: '2.7' # Use PYENV_VERSION with CPython, specific major.minor.change version - - env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' + - python: pypy + env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' # Use PYENV_VERSION with PyPy - - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' + - python: pypy + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' # Use PYENV_VERSION with PyPy and Custom options - - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYENV_CACHE_PATH=$HOME/.pyenv-pypy-cache + - python: pypy + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYENV_CACHE_PATH=$HOME/.pyenv-pypy-cache # Legacy setup-pypy.sh - python: pypy env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh From af1ae6bbe9edcd8043af03e85f2a45909fa9cc71 Mon Sep 17 00:00:00 2001 From: jthomale Date: Mon, 20 Mar 2017 11:00:07 -0500 Subject: [PATCH 11/21] Make stylistic corrections to setup-pyenv.sh and README.md --- README.md | 2 +- setup-pyenv.sh | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d2ca7f4..582a582 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ With [Travis CI](https://travis-ci.org), sometimes you want to test your project code using an unsupported Python build, such as an exact version of [CPython](http://www.python.org), a more recent version of [PyPy](http://pypy.org), or any number of other Python implementations. You can use [pyenv](https://github.com/yyuu/pyenv) to install a very specific Python version or distribution, but setting it up properly in a Travis CI build environment can be tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) you can download and call in your `.travis.yml` configuration to simplify this process. ## Usage -1. In your `.travis.yml` file, to run tests against non-Travis versions of Python, use the `$PYENV_VERSION` environment variable to set the pyenv Python version. (You can also set an appropriate value for `python`, as you normally would, for jobs where you want to continue running tests against Python versions that are already supported by Travis.) +1. Set the `$PYENV_VERSION` environment variable to the Python to install. 2. Tell Travis to cache the `$HOME/.pyenv_cache` directory OR (optionally) some other directory you specify in the `$PYENV_CACHE_PATH` environment variable. 3. Download and source the `setup-pyenv.sh` script in `before_install`. 4. Build your project and run your tests as usual. diff --git a/setup-pyenv.sh b/setup-pyenv.sh index c34f276..9df4b1b 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -25,7 +25,7 @@ version_pyenv_path="$PYENV_ROOT/versions/$PYENV_VERSION" # PYENV_VERSION_STRING is set, then it validates the returned version string # as well (using fgrep). Returns whatever status code the command returns. verify_python() { - local python_bin="$1" + local python_bin="$1"; shift if [[ -n "$PYENV_VERSION_STRING" ]]; then "$python_bin" --version 2>&1 | fgrep "$PYENV_VERSION_STRING" &>/dev/null @@ -46,8 +46,8 @@ use_cached_python() { return 0 else printf "FAILED.\nClearing cached version..." - rm -f $version_pyenv_path - rm -rf $version_cache_path + rm -f "$version_pyenv_path" + rm -rf "$version_cache_path" printf "done.\n" return 1 fi @@ -63,14 +63,12 @@ output_debugging_info() { printf "PYENV_VERSION\n$PYENV_VERSION\n" printf "PYENV_VERSION_STRING\n$PYENV_VERSION_STRING\n" printf "PYENV_CACHE_PATH\n$PYENV_CACHE_PATH\n" - echo "python --version" + set -x python --version - echo "$version_cache_path/bin/python --version" $version_cache_path/bin/python --version - echo "which python" which python - echo "pyenv which python" pyenv which python + set +x } # Main script begins. @@ -117,7 +115,7 @@ if ! use_cached_python; then return 1 fi else - echo "** Warning: Python was succesfully built, but moving to cache" + echo "**** Warning: Python was succesfully built, but moving to cache" echo "failed. Proceeding anyway without caching." fi else From 6f3932f7f4b3514c5491b6faae264553093d3dc2 Mon Sep 17 00:00:00 2001 From: jthomale Date: Mon, 20 Mar 2017 11:58:30 -0500 Subject: [PATCH 12/21] Update initial README.md instructions Revised initial README.md instructions to more closely match original. My main reason for changing them was to include more use cases than just PyPy, so I turned that third sentence into a bulleted list. Hopefully this accomplishes that goal while also keeping it simple. --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 582a582..cf057ff 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ # travis-pyenv -With [Travis CI](https://travis-ci.org), sometimes you want to test your project code using an unsupported Python build, such as an exact version of [CPython](http://www.python.org), a more recent version of [PyPy](http://pypy.org), or any number of other Python implementations. You can use [pyenv](https://github.com/yyuu/pyenv) to install a very specific Python version or distribution, but setting it up properly in a Travis CI build environment can be tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) you can download and call in your `.travis.yml` configuration to simplify this process. +Set up [pyenv](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org) builds. + +Setting up pyenv properly in a Travis CI build environment can be quite tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) that makes this process much simpler. + +Use cases for this include: + +* Install an up-to-date version of [PyPy](http://pypy.org). The Travis CI build images currently contain a very old version of PyPy which breaks some common Python modules. +* Install an exact version of [CPython](http://www.python.org) or some other lesser-known distribution that Travis CI doesn't support. +* Install Python on Mac OS X builds. ## Usage 1. Set the `$PYENV_VERSION` environment variable to the Python to install. -2. Tell Travis to cache the `$HOME/.pyenv_cache` directory OR (optionally) some other directory you specify in the `$PYENV_CACHE_PATH` environment variable. +2. Tell Travis to cache the `$HOME/.pyenv_cache` directory. 3. Download and source the `setup-pyenv.sh` script in `before_install`. 4. Build your project and run your tests as usual. From 49e29d046063a5e3f4b8ded9ce0e6cf8e8e374df Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 10:27:09 +0200 Subject: [PATCH 13/21] Update example download link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf057ff..60e5fc5 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ cache: before_install: - | if [[ -n "$PYENV_VERSION" ]]; then - wget https://github.com/jthomale/travis-pyenv/raw/fullbuild/setup-pyenv.sh - source setup-pyenv.sh + git clone --depth 1 https://github.com/praekeltfoundation/travis-pyenv.git + source travis-pyenv/setup-pyenv.sh fi script: From 08bd66bc021853fb0b1f1b658fc118a8fc6dd2ab Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 10:40:56 +0200 Subject: [PATCH 14/21] Test with more modern PyPy versions --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa4299f..f1fce2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,17 +6,17 @@ matrix: # Normal method of specifying Python version - python: '2.7' # Use PYENV_VERSION with CPython, specific major.minor.change version - - python: pypy + - language: python env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' # Use PYENV_VERSION with PyPy - python: pypy - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' + env: PYENV_VERSION=pypy-portable-5.7.0 PYENV_VERSION_STRING='PyPy 5.7.0' # Use PYENV_VERSION with PyPy and Custom options - python: pypy - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYENV_CACHE_PATH=$HOME/.pyenv-pypy-cache + env: PYENV_VERSION=pypy-portable-5.6.0 PYENV_VERSION_STRING='PyPy 5.6.0' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.8 PYENV_CACHE_PATH=$HOME/.pyenv-pypy-cache # Legacy setup-pypy.sh - python: pypy - env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh + env: PYPY_VERSION=5.6.0 SETUP_SCRIPT=setup-pypy.sh # macOS # Note that the `python` key is *not* set. # If set, TravisCI will not even start the build and fail since there's From 8d1e8307f2e49d175358b53f49f978385f957393 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 10:46:07 +0200 Subject: [PATCH 15/21] Only deactivate the virtualenv if we're actually in one --- setup-pyenv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 9df4b1b..551ef4d 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -78,8 +78,8 @@ if [[ -z "$PYENV_VERSION" ]]; then return 0 fi -# Get out of the virtualenv we're in. -deactivate +# Get out of the virtualenv we're in (if we're in one). +[[ -z "$VIRTUAL_ENV" ]] || deactivate # Install pyenv echo "**** Installing pyenv." From e4bb3994c85e6d73d1e17c21b689bf3d296eda83 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 10:52:15 +0200 Subject: [PATCH 16/21] Travis: Try set --- .travis.yml | 5 +++-- README.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1fce2e..9797e67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,14 @@ +language: python env: global: - SETUP_SCRIPT=setup-pyenv.sh + matrix: include: # Normal method of specifying Python version - python: '2.7' # Use PYENV_VERSION with CPython, specific major.minor.change version - - language: python - env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' + - env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' # Use PYENV_VERSION with PyPy - python: pypy env: PYENV_VERSION=pypy-portable-5.7.0 PYENV_VERSION_STRING='PyPy 5.7.0' diff --git a/README.md b/README.md index 60e5fc5..6425ce5 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ matrix: include: - env: PYENV_VERSION='2.7.13' PYENV_VERSION_STRING='Python 2.7.13' - python: '3.5' - - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' + - env: PYENV_VERSION=pypy-portable-5.7.0 PYENV_VERSION_STRING='PyPy 5.7.0' cache: - pip - directories: From bcabc89ce3999bdb0788b477f0872bc32e33b10d Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 11:07:24 +0200 Subject: [PATCH 17/21] Override the language for osx and tweak comments --- .travis.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9797e67..ef7921c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,18 +19,20 @@ matrix: - python: pypy env: PYPY_VERSION=5.6.0 SETUP_SCRIPT=setup-pypy.sh # macOS - # Note that the `python` key is *not* set. - # If set, TravisCI will not even start the build and fail since there's - # no Python tarball to download and install on macOS. - # See https://github.com/travis-ci/travis-ci/issues/2312 for details - # So, it shows up as Ruby in TravisCI but as the PYENV_VERSION_STRING check - # can attest, we are still fine. - - os: 'osx' + # Note that the `python` key is *not* set and the language is overridden to + # *not* be `python`. If set to `python`, the build will fail, complaining + # that there's no Python tarball to download and install on macOS. + # See https://github.com/travis-ci/travis-ci/issues/2312 for details. + # So, it shows up as Ruby in the Travis UI but as the PYENV_VERSION_STRING + # check can attest, we are still fine. + - os: osx + language: ruby env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' # macOS Framework Build # Useful for PyInstaller # Example issue: https://github.com/pyenv/pyenv/issues/443 - - os: 'osx' + - os: osx + language: ruby env: PYENV_VERSION=3.6.0 PYENV_VERSION_STRING='Python 3.6.0' PYTHON_CONFIGURE_OPTS="--enable-framework" cache: From b2736f9c38f01a3b12f9ba22e731d40ace59db75 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 11:07:59 +0200 Subject: [PATCH 18/21] README: Mac OS X -> macOS --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6425ce5..be5bc03 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Use cases for this include: * Install an up-to-date version of [PyPy](http://pypy.org). The Travis CI build images currently contain a very old version of PyPy which breaks some common Python modules. * Install an exact version of [CPython](http://www.python.org) or some other lesser-known distribution that Travis CI doesn't support. -* Install Python on Mac OS X builds. +* Install Python on macOS builds. ## Usage 1. Set the `$PYENV_VERSION` environment variable to the Python to install. From 3df1aad44e61847c09686e66d7555d6f24920412 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 11:18:08 +0200 Subject: [PATCH 19/21] Travis: simplify setup script selection --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef7921c..db761f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,4 @@ language: python -env: - global: - - SETUP_SCRIPT=setup-pyenv.sh - matrix: include: # Normal method of specifying Python version @@ -41,7 +37,7 @@ cache: - "${PYENV_CACHE_PATH:-$HOME/.pyenv_cache}" script: - - source $SETUP_SCRIPT + - source "${SETUP_SCRIPT:-setup-pyenv.sh}" - python --version deploy: From 2d1a5ef117739453b79a40b3e761d08a48da973b Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 11:23:38 +0200 Subject: [PATCH 20/21] Add some badges --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index be5bc03..c8f236a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # travis-pyenv + +[![GitHub release](https://img.shields.io/github/release/praekeltfoundation/travis-pyenv.svg?style=flat-square)](https://github.com/praekeltfoundation/travis-pyenv/releases/latest) +[![Build status](https://img.shields.io/travis/praekeltfoundation/travis-pyenv/develop.svg?style=flat-square)](https://travis-ci.org/praekeltfoundation/travis-pyenv) + Set up [pyenv](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org) builds. Setting up pyenv properly in a Travis CI build environment can be quite tricky. This repo contains a script ([`setup-pyenv.sh`](setup-pyenv.sh)) that makes this process much simpler. From cb9c8ba7df57bcbb09d4d055d9285ed1d6da2ef0 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 22 Mar 2017 11:34:38 +0200 Subject: [PATCH 21/21] Release 0.3.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8f236a..5b99a9d 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ cache: before_install: - | if [[ -n "$PYENV_VERSION" ]]; then - git clone --depth 1 https://github.com/praekeltfoundation/travis-pyenv.git - source travis-pyenv/setup-pyenv.sh + wget https://github.com/praekeltfoundation/travis-pyenv/releases/download/0.3.0/setup-pyenv.sh + source setup-pyenv.sh fi script: