From 11a856048868e484c7a9e8ede6627e8016d46be4 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:02:06 +0200 Subject: [PATCH 01/16] Generalize to a pyenv setup script * The PyPy-specific parts are small --- .travis.yml | 8 ++++---- README.md | 29 +++++++++++++++------------- setup-pypy.sh => setup-pyenv.sh | 34 ++++++++++++++++++++------------- 3 files changed, 41 insertions(+), 30 deletions(-) rename setup-pypy.sh => setup-pyenv.sh (54%) diff --git a/.travis.yml b/.travis.yml index 24fa5f8..d4271c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - python: "2.7" # Basic options - python: "pypy" - env: PYPY_VERSION="5.3.1" + env: PYENV_VERSION="pypy-5.4.1" # Custom options - python: "pypy" - env: PYPY_VERSION="5.3" PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v20160629 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache + env: PYENV_VERSION="pypy-5.3" PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v20160629 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache cache: - pip @@ -16,13 +16,13 @@ cache: - $HOME/.pyenv_cache script: - - source setup-pypy.sh + - source setup-pyenv.sh - python --version deploy: provider: releases api_key: secure: ZbOjmIOmz3TsPFhM7U+RddpJxVJDfudHhKyr+ZIgc/xTDYuzGDD8VRkexpT3dGoDUpgve0SyHPeeg0Otq54mHaaig4RKQN+xDmBtFnbK+zlqjH9pM14p239wPfuMOksWIUzM15QqWe2DQoJ2BrcTdgP2EntNfJIshsoWK8EZADlqIflwLVSRNJ3qKCW+ScO+XI9CGavnKvm+J1/tBUfF8MyR4HGdFlUw17jzsdz0p5O/D7EM8VHqSGNMy6FtKkvnwuyK6gDgE8Y1o1luTDA6Ii1Qr9d0d1Oo23QIk7XxxLICnBZ+BuUIxr457TKQ1/G52J77xj7rmlo8ntdpY29I1cH8qxsyv2eUZskfO+Zvycgw/cVPkUVW24AiBT2s6cyifI56jIMircPaBGvvA/w0kbkUKAKKBsm49esgaQoxb+ewkxhNUXVo85P6IOG+vuOLiefKByOrDAYhRn8vgWwi51IBZlakjZpwP2x7Os9ffllBlRsQp4l2F6QzNVlkshJpBP7HeEl0HbWjnewmRYhmrnCpvQwI4jBFCrjMcFv763z2BNwTbfLVLZvXCKY4bQM4A/h9bdmt83OVwHqVE8sUuFs6/7iLXdfV+phSEWk/fjR9KA/pf49Jja1rzsqCS+SwPU1rr9M865RPm+1zy4ll2BnUde2o3g6kZEz5XAKl1Ig= - file: setup-pypy.sh + file: setup-pyenv.sh on: tags: true diff --git a/README.md b/README.md index dbc9e88..e01cf35 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ -# travis-pypy -Set up a more recent [PyPy](http://pypy.org) to use in [Travis CI](https://travis-ci.org). +# travis-pyenv +Set up [`pyenv`](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org). The Travis CI build images currently contain a very old version of PyPy which breaks a bunch of Python modules. This repository contains a script that can be used to set up a newer version of PyPy in your Travis CI builds using [pyenv](https://github.com/yyuu/pyenv). ## Usage -1. Set the `$PYPY_VERSION` environment variable to the version of PyPy to install. +1. Set the `$PYENV_VERSION` environment variable to the Python to install. 2. Tell Travis to cache the `$HOME/.pyenv_cache` directory. 3. Download and source the script in `before_install`. There are a few install options that can be set via environment variables: -* `PYPY_VERSION` - Version of PyPy2 to install [required] +* `PYENV_VERSION` + The pyenv to install [required] +* `PYENV_VERSION_PATTERN` + Pattern to grep against the output of `python --version` to validate that the correct Python was installed [default: none] * `PYENV_ROOT` Directory in which to install pyenv [default: `~/.pyenv`] * `PYENV_RELEASE` @@ -24,23 +26,24 @@ There are a few install options that can be set via environment variables: language: python matrix: include: - - python: "2.7" - - python: "pypy" - env: PYPY_VERSION="5.3.1" + - python: '2.7' + - python: '3.5' + - python: pypy + env: PYENV_VERSION="pypy-5.4.1" PYENV_VERSION_PATTERN="PyPy 5\.4\.1" cache: - pip - directories: - - $HOME/.pyenv_cache + - ~/.pyenv_cache before_install: - | - if [[ -n "$PYPY_VERSION" ]]; then - wget https://github.com/praekeltfoundation/travis-pypy/releases/download/0.1.0/setup-pypy.sh - source setup-pypy.sh + if [[ -n "$PYENV_VERSION" ]]; then + git clone https://github.com/praekeltfoundation/travis-pyenv.git ~/travis-pyenv + source ~/travis-pyenv/setup-pyenv.sh fi script: - - py.test my_project + - pytest my_project ``` ## Notes diff --git a/setup-pypy.sh b/setup-pyenv.sh similarity index 54% rename from setup-pypy.sh rename to setup-pyenv.sh index 8a399ab..1eb2f1a 100644 --- a/setup-pypy.sh +++ b/setup-pyenv.sh @@ -1,8 +1,11 @@ # NOTE: This script needs to be sourced so it can modify the environment. # # Environment variables that can be set: -# - PYPY_VERSION -# Version of PyPy2 to install [required] +# - PYENV_VERSION +# Python to install [required] +# - PYENV_VERSION_PATTERN +# Pattern to grep against the output of `python --version` to validate that +# the correct Python was installed [default: none] # - PYENV_ROOT # Directory in which to install pyenv [default: ~/.pyenv] # - PYENV_RELEASE @@ -10,8 +13,8 @@ # - PYTHON_BUILD_CACHE_PATH: # Directory in which to cache PyPy builds [default: ~/.pyenv_cache] -if [[ -z "$PYPY_VERSION" ]]; then - echo "\$PYPY_VERSION is not set. Not installing PyPy." +if [[ -z "$PYENV_VERSION" ]]; then + echo "\$PYENV_VERSION is not set. Not installing a pyenv." return 0 fi @@ -23,7 +26,7 @@ PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" if [[ -n "$PYENV_RELEASE" ]]; then # Fetch the release archive from Github (slightly faster than cloning) mkdir "$PYENV_ROOT" - curl -SL "https://github.com/yyuu/pyenv/archive/$PYENV_RELEASE.tar.gz" | \ + curl -fSL "https://github.com/yyuu/pyenv/archive/$PYENV_RELEASE.tar.gz" | \ tar -xz -C "$PYENV_ROOT" --strip-components 1 else # Don't have a release to fetch, so just clone directly @@ -37,13 +40,18 @@ eval "$(pyenv init -)" PYTHON_BUILD_CACHE_PATH="${PYTHON_BUILD_CACHE_PATH:-$HOME/.pyenv_cache}" mkdir -p "$PYTHON_BUILD_CACHE_PATH" -# Install pypy and make a virtualenv for it. -pyenv install -s pypy-$PYPY_VERSION -pyenv global pypy-$PYPY_VERSION -virtualenv -p $(which python) "$HOME/env-pypy-$PYPY_VERSION" -source "$HOME/env-pypy-$PYPY_VERSION/bin/activate" +# Install the pyenv (pyenv reads $PYENV_VERSION to know what to install) +pyenv install +pyenv global -if ! python --version 2>&1 | fgrep "PyPy $PYPY_VERSION"; then - echo "Failed to verify that PyPy was properly installed." - return 1 +# Make and source a new virtualenv +VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_PYTHON" +virtualenv -p "$(which python)" "$VIRTUAL_ENV" +source "$VIRTUAL_ENV/bin/activate" + +if [[ -n "$PYENV_VERSION_PATTERN" ]]; then + if ! python --version 2>&1 | fgrep -E "$PYENV_VERSION_PATTERN"; then + echo "Failed to verify that the pyenv was properly installed." + return 1 + fi fi From d6f9dc897bc93e6d4d58fe29d9081e5bee68cb88 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:16:47 +0200 Subject: [PATCH 02/16] Pyenv doesn't actually read $PYENV_VERSION when installing --- setup-pyenv.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 1eb2f1a..2cb3206 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -40,9 +40,9 @@ eval "$(pyenv init -)" PYTHON_BUILD_CACHE_PATH="${PYTHON_BUILD_CACHE_PATH:-$HOME/.pyenv_cache}" mkdir -p "$PYTHON_BUILD_CACHE_PATH" -# Install the pyenv (pyenv reads $PYENV_VERSION to know what to install) -pyenv install -pyenv global +# Install the pyenv +pyenv install "$PYENV_VERSION" +pyenv global "$PYENV_VERSION" # Make and source a new virtualenv VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_PYTHON" From e0a1a0b1c3882c7688baa3dc27dcdaae07460f95 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:17:11 +0200 Subject: [PATCH 03/16] Tweak Travis options --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4271c4..a6a12cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - python: "2.7" # Basic options - python: "pypy" - env: PYENV_VERSION="pypy-5.4.1" + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5\.4\.1' # Custom options - python: "pypy" - env: PYENV_VERSION="pypy-5.3" PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v20160629 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5\.4\.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache cache: - pip From a78f51af317a78db9cb4ce68c56ecf993f785c92 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:32:14 +0200 Subject: [PATCH 04/16] Apparently we can't use extended regex with fgrep (?) --- .travis.yml | 4 ++-- README.md | 2 +- setup-pyenv.sh | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6a12cb..db358cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - python: "2.7" # Basic options - python: "pypy" - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5\.4\.1' + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5.4.1' # Custom options - python: "pypy" - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5\.4\.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache + env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache cache: - pip diff --git a/README.md b/README.md index e01cf35..312918c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ There are a few install options that can be set via environment variables: * `PYENV_VERSION` The pyenv to install [required] * `PYENV_VERSION_PATTERN` - Pattern to grep against the output of `python --version` to validate that the correct Python was installed [default: none] + Pattern to (f)grep against the output of `python --version` to validate that the correct Python was installed [default: none] * `PYENV_ROOT` Directory in which to install pyenv [default: `~/.pyenv`] * `PYENV_RELEASE` diff --git a/setup-pyenv.sh b/setup-pyenv.sh index 2cb3206..cd16f14 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -4,8 +4,8 @@ # - PYENV_VERSION # Python to install [required] # - PYENV_VERSION_PATTERN -# Pattern to grep against the output of `python --version` to validate that -# the correct Python was installed [default: none] +# Pattern to (f)grep against the output of `python --version` to validate +# that the correct Python was installed [default: none] # - PYENV_ROOT # Directory in which to install pyenv [default: ~/.pyenv] # - PYENV_RELEASE @@ -50,7 +50,7 @@ virtualenv -p "$(which python)" "$VIRTUAL_ENV" source "$VIRTUAL_ENV/bin/activate" if [[ -n "$PYENV_VERSION_PATTERN" ]]; then - if ! python --version 2>&1 | fgrep -E "$PYENV_VERSION_PATTERN"; then + if ! python --version 2>&1 | fgrep "$PYENV_VERSION_PATTERN"; then echo "Failed to verify that the pyenv was properly installed." return 1 fi From af2bb2ac3c98a3560ea2ad51a9ffa7e09d1289a2 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:36:36 +0200 Subject: [PATCH 05/16] Stick to well-known pytest command in example Travis file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 312918c..8e1d057 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ before_install: fi script: - - pytest my_project + - py.test my_project ``` ## Notes From 7d92754596a84fd85ea46285d17b5d8500beab9a Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:50:32 +0200 Subject: [PATCH 06/16] Learn about fgrep and change PATTERN->STRING --- .travis.yml | 4 ++-- README.md | 6 +++--- setup-pyenv.sh | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index db358cf..07605b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - python: "2.7" # Basic options - python: "pypy" - env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_PATTERN='PyPy 5.4.1' + 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_PATTERN='PyPy 5.4.1' PYENV_ROOT=$HOME/.pyenv-pypy PYENV_RELEASE=v1.0.2 PYTHON_BUILD_CACHE=$HOME/.pyenv-pypy-cache + 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 cache: - pip diff --git a/README.md b/README.md index 8e1d057..756ac45 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ The Travis CI build images currently contain a very old version of PyPy which br There are a few install options that can be set via environment variables: * `PYENV_VERSION` The pyenv to install [required] -* `PYENV_VERSION_PATTERN` - Pattern to (f)grep against the output of `python --version` to validate that the correct Python was installed [default: none] +* `PYENV_VERSION_STRING` + String to `fgrep` against the output of `python --version` to validate that the correct Python was installed (recommended) [default: none] * `PYENV_ROOT` Directory in which to install pyenv [default: `~/.pyenv`] * `PYENV_RELEASE` @@ -29,7 +29,7 @@ matrix: - python: '2.7' - python: '3.5' - python: pypy - env: PYENV_VERSION="pypy-5.4.1" PYENV_VERSION_PATTERN="PyPy 5\.4\.1" + env: PYENV_VERSION="pypy-5.4.1" PYENV_VERSION_STRING="PyPy 5.4.1" cache: - pip - directories: diff --git a/setup-pyenv.sh b/setup-pyenv.sh index cd16f14..ee9a356 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -3,9 +3,9 @@ # Environment variables that can be set: # - PYENV_VERSION # Python to install [required] -# - PYENV_VERSION_PATTERN -# Pattern to (f)grep against the output of `python --version` to validate -# that the correct Python was installed [default: none] +# - PYENV_VERSION_STRING +# String to `fgrep` against the output of `python --version` to validate +# that the correct Python was installed (recommended) [default: none] # - PYENV_ROOT # Directory in which to install pyenv [default: ~/.pyenv] # - PYENV_RELEASE @@ -49,8 +49,8 @@ VIRTUAL_ENV="$HOME/ve-pyenv-$PYENV_PYTHON" virtualenv -p "$(which python)" "$VIRTUAL_ENV" source "$VIRTUAL_ENV/bin/activate" -if [[ -n "$PYENV_VERSION_PATTERN" ]]; then - if ! python --version 2>&1 | fgrep "$PYENV_VERSION_PATTERN"; then +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 From 4351e978819d8a2dd6ad59069c52eba2ec73263a Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 11:52:21 +0200 Subject: [PATCH 07/16] Tweak curl command * I now prefer the pipe on the next line * Big 'S' while not in silent mode 's' does nothing --- setup-pyenv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-pyenv.sh b/setup-pyenv.sh index ee9a356..36a6127 100644 --- a/setup-pyenv.sh +++ b/setup-pyenv.sh @@ -26,8 +26,8 @@ PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" if [[ -n "$PYENV_RELEASE" ]]; then # Fetch the release archive from Github (slightly faster than cloning) mkdir "$PYENV_ROOT" - curl -fSL "https://github.com/yyuu/pyenv/archive/$PYENV_RELEASE.tar.gz" | \ - tar -xz -C "$PYENV_ROOT" --strip-components 1 + curl -fsSL "https://github.com/yyuu/pyenv/archive/$PYENV_RELEASE.tar.gz" \ + | tar -xz -C "$PYENV_ROOT" --strip-components 1 else # Don't have a release to fetch, so just clone directly git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT" From 458456b34b945605f61c54ac69868524dca8358e Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:11:14 +0200 Subject: [PATCH 08/16] Try add a legacy setup-pypy.sh script for users of the old script --- .travis.yml | 7 ++++++- setup-pypy.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 setup-pypy.sh diff --git a/.travis.yml b/.travis.yml index 07605b0..c362175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: python +env: + - SETUP_SCRIPT=setup-pyenv.sh matrix: include: # Without PyPy @@ -9,6 +11,9 @@ matrix: # 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 + # Legacy setup-pypy.sh + - python: "pypy" + env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh cache: - pip @@ -16,7 +21,7 @@ cache: - $HOME/.pyenv_cache script: - - source setup-pyenv.sh + - source $SETUP_SCRIPT - python --version deploy: diff --git a/setup-pypy.sh b/setup-pypy.sh new file mode 100644 index 0000000..542de59 --- /dev/null +++ b/setup-pypy.sh @@ -0,0 +1,26 @@ +# DEPRECATED: Please use setup-pyenv.sh rather. +# NOTE: This script needs to be sourced so it can modify the environment. +# +# Environment variables that can be set: +# - PYPY_VERSION +# Version of PyPy2 to install [required] +# - PYENV_ROOT +# 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] + +echo 'WARNING: setup-pypy.sh is *deprecated*. Please use setup-pyenv.sh rather.' +echo 'setup-pypy.sh will be removed in the next release.' + +if [[ -z "$PYPY_VERSION" ]]; then + echo "\$PYPY_VERSION is not set. Not installing PyPy." + return 0 +fi + +export PYENV_VERSION="$PYPY_VERSION" +export PYENV_VERSION_STRING="PyPy $PYPY_VERSION" + +SCRIPT="$(readlink -f $0)" +source "$(dirname $SCRIPT)"/setup-pyenv.sh From 547a9582b535b5fe5e8d7b370a468dadb45f4074 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:12:45 +0200 Subject: [PATCH 09/16] Travis: Try fix env matrix --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c362175..bfe81d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python env: - - SETUP_SCRIPT=setup-pyenv.sh + global: + - SETUP_SCRIPT=setup-pyenv.sh matrix: include: # Without PyPy From 06ff0d9c460d0e47eb5c236002126b1d3b7c0a6d Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:13:49 +0200 Subject: [PATCH 10/16] Travis: style tweaks --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfe81d3..a96c324 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,15 @@ env: matrix: include: # Without PyPy - - python: "2.7" + - python: '2.7' # Basic options - - python: "pypy" + - python: pypy env: PYENV_VERSION=pypy-5.4.1 PYENV_VERSION_STRING='PyPy 5.4.1' # Custom options - - python: "pypy" + - 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 # Legacy setup-pypy.sh - - python: "pypy" + - python: pypy env: PYPY_VERSION=5.4.1 SETUP_SCRIPT=setup-pypy.sh cache: From 60ebf90e608dbc3acdccdeadc5a0b1e33b97fbb2 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:19:06 +0200 Subject: [PATCH 11/16] Try fix sourcing from setup-pypy.sh --- setup-pypy.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup-pypy.sh b/setup-pypy.sh index 542de59..5753837 100644 --- a/setup-pypy.sh +++ b/setup-pypy.sh @@ -22,5 +22,4 @@ fi export PYENV_VERSION="$PYPY_VERSION" export PYENV_VERSION_STRING="PyPy $PYPY_VERSION" -SCRIPT="$(readlink -f $0)" -source "$(dirname $SCRIPT)"/setup-pyenv.sh +source "$(dirname "$BASH_SOURCE")"/setup-pyenv.sh From f25084f51556b5b51e4b7a99fad5d11ea5ea266a Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:21:20 +0200 Subject: [PATCH 12/16] Fix setup-pyenv.sh PYENV_VERSION variable --- setup-pypy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-pypy.sh b/setup-pypy.sh index 5753837..07648f2 100644 --- a/setup-pypy.sh +++ b/setup-pypy.sh @@ -19,7 +19,7 @@ if [[ -z "$PYPY_VERSION" ]]; then return 0 fi -export PYENV_VERSION="$PYPY_VERSION" +export PYENV_VERSION="pypy-$PYPY_VERSION" export PYENV_VERSION_STRING="PyPy $PYPY_VERSION" source "$(dirname "$BASH_SOURCE")"/setup-pyenv.sh From 454822de5187d1ccaf6e7b6b39aa26f58df27c4b Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:42:43 +0200 Subject: [PATCH 13/16] Tweak example Travis file quoting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 756ac45..a8c765b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ matrix: - python: '2.7' - 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: From d46236a99aa7b4f7dd6b2fde8c8ca7460f653764 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:50:02 +0200 Subject: [PATCH 14/16] Update README intro paragraph --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a8c765b..f8e9d93 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # travis-pyenv -Set up [`pyenv`](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org). +Set up [`pyenv`](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org) builds. -The Travis CI build images currently contain a very old version of PyPy which breaks a bunch of Python modules. This repository contains a script that can be used to set up a newer version of PyPy in your Travis CI builds using [pyenv](https://github.com/yyuu/pyenv). +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. ## Usage 1. Set the `$PYENV_VERSION` environment variable to the Python to install. From 659d614abe77e00343c17766401695b4c286b88e Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Mon, 10 Oct 2016 12:56:00 +0200 Subject: [PATCH 15/16] README: don't `` pyenv but do `` all paths --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8e9d93..e45c6c3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # travis-pyenv -Set up [`pyenv`](https://github.com/yyuu/pyenv) to use in [Travis CI](https://travis-ci.org) builds. +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. +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. @@ -50,4 +50,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. -* 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. +* 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. From 6246405a5175262fcd5c387671f6c833414819de Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Tue, 1 Nov 2016 09:36:58 +0200 Subject: [PATCH 16/16] Prepare 0.2.0 release --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e45c6c3..228e931 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ cache: before_install: - | if [[ -n "$PYENV_VERSION" ]]; then - git clone https://github.com/praekeltfoundation/travis-pyenv.git ~/travis-pyenv - source ~/travis-pyenv/setup-pyenv.sh + wget https://github.com/praekeltfoundation/travis-pyenv/releases/download/0.2.0/setup-pyenv.sh + source setup-pyenv.sh fi script: