before_install.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. set -e
  3. set -o pipefail
  4. echo 'Python info:'
  5. (
  6. set -x
  7. python3 --version
  8. python2 --version
  9. python --version
  10. pip3 --version
  11. pip2 --version
  12. pip --version
  13. pyenv --version
  14. pyenv versions
  15. ) 2>&1 | sed 's/^/ /' || true
  16. # Use pyenv, but not for OSX on Travis, where it only has the "system" version.
  17. if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
  18. echo 'Setting Python versions via pyenv'
  19. # Prefer Python 2 over 3 (more conservative).
  20. pyenv global 2.7:3.8
  21. echo 'Updated Python info:'
  22. (
  23. set -x
  24. python3 --version
  25. python2 --version
  26. python --version
  27. python3 -m pip --version
  28. python2 -m pip --version
  29. ) 2>&1 | sed 's/^/ /'
  30. fi
  31. echo "Install node (LTS)"
  32. if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
  33. curl -o ~/.nvm/nvm.sh https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh
  34. fi
  35. source ~/.nvm/nvm.sh
  36. nvm install 10
  37. if [[ -n "$CMAKE_URL" ]]; then
  38. echo "Installing custom CMake: $CMAKE_URL"
  39. curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
  40. mkdir -p "$HOME/.local/bin" /opt/cmake-custom
  41. bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
  42. ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
  43. cmake_version="$(cmake --version)"
  44. echo "$cmake_version" | grep -qF '2.8.12' || {
  45. echo "Unexpected CMake version: $cmake_version"
  46. exit 1
  47. }
  48. fi