ci: Travis: simplify/improve Python/pip setup (#10228)

* ci/before_install.sh: do not (try to) upgrade pip

  It is not necessary usually (for our use case(s)), and rather good to
  have this (implicitly) pinned.

* Simplify/improve Python info output

* Use pyenv-global to activate/use Python 2.7/7.7

* simplify pip-install of neovim, also for osx
This commit is contained in:
Daniel Hahler 2019-06-18 20:13:47 +02:00 committed by GitHub
parent 149dcbf2c7
commit c6ce40bf37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 31 deletions

View File

@ -7,28 +7,34 @@ if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
echo 'python info:'
echo 'Python info:'
(
2>&1 python --version || true
2>&1 python2 --version || true
2>&1 python3 --version || true
2>&1 pip --version || true
2>&1 pip2 --version || true
2>&1 pip3 --version || true
echo 'pyenv versions:'
2>&1 pyenv versions || true
) | sed 's/^/ /'
set -x
python3 --version
python2 --version
python --version
pip3 --version
pip2 --version
pip --version
pyenv versions
) 2>&1 | sed 's/^/ /' || true
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
echo "Upgrade Python 3 pip"
python3 -m pip -q install --user --upgrade pip
else
echo "Upgrade Python 2 pip"
python2.7 -m pip -q install --user --upgrade pip
echo "Upgrade Python 3 pip"
# Allow failure. pyenv pip3 on travis is broken:
# https://github.com/travis-ci/travis-ci/issues/8363
python3 -m pip -q install --user --upgrade pip || true
# Use pyenv, but not for OSX on Travis, where it only has the "system" version.
if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
echo 'Setting Python versions via pyenv'
# Prefer python2 as python for /usr/bin/asan_symbolize-4.0.
pyenv global 2.7.15:3.7
echo 'Updated Python info:'
(
set -x
python3 --version
python2 --version
python --version
pip3 --version
pip2 --version
) 2>&1 | sed 's/^/ /'
fi
echo "Install node (LTS)"

View File

@ -11,18 +11,11 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
export PATH="/usr/local/opt/ccache/libexec:$PATH"
fi
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 3."
# Allow failure. pyenv pip3 on travis is broken:
# https://github.com/travis-ci/travis-ci/issues/8363
CC=cc python3 -m pip -q install --user --upgrade neovim || true
if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then
# Update PATH for pip.
export PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 2."
CC=cc python2.7 -m pip -q install --user --upgrade neovim
fi
CC=cc pip3 -q install --user --upgrade neovim
echo "Install neovim module for Python 2."
CC=cc pip2 -q install --user --upgrade neovim
echo "Install neovim RubyGem."
gem install --no-document --version ">= 0.8.0" neovim