diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..ab5bb2d0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: python + +python: +- "3.7-dev" +- "3.6" +- "3.5" +- "3.4" +- "3.3" +- "3.2" +- "2.7" +- "2.6" + +env: +- SCRIPT_SRC=local +- SCRIPT_SRC=remote + +cache: + pip: true + +install: +- pip uninstall --yes setuptools pip + +script: +- .travis/helpers.sh "$TRAVIS_PYTHON_VERSION" "$SCRIPT_SRC" +- pip -V + +jobs: + fast_finish: true diff --git a/.travis/helpers.sh b/.travis/helpers.sh new file mode 100755 index 00000000..093a5ebf --- /dev/null +++ b/.travis/helpers.sh @@ -0,0 +1,53 @@ +#! /usr/bin/env bash + +DEBUG=$DEBUG + +set -euo pipefail + +[[ -n "$DEBUG" ]] && set -xv + +declare -a SPECIAL_VERSIONS=('2.6' '3.2' '3.3') + +function find_get_pip_version() { + local version="$1" + + for v in "${SPECIAL_VERSIONS[@]}" + do + [[ "$version" == "$v" ]] && echo "$version" && return 0 + done + + return 1 +} + +function cat_get_pip() { + local version=$(find_get_pip_version "$1") + + local path="get-pip.py" + [[ -n "$version" ]] && path="$version/$path" + local src="$2" + local cmd=cat + if [[ "$src" == "remote" ]] + then + path="https://bootstrap.pypa.io/$path" + cmd='wget -O - ' + >&2 echo Downloading bootstrap script from remote... + elif [[ "$src" != "local" ]] + then + >&2 echo Wrong source argument: $src + exit 1 + fi + + >&2 echo Version $1 requires following script: $path + $cmd $path +} + +function main() { + local python_version="$1" + local get_pip_src="$2" + cat_get_pip "$python_version" "$get_pip_src" | python - +} + +# Reset settings +set +eu + +main $*