travis_install.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. set -ev
  3. ####################
  4. # OS-specific setup
  5. ####################
  6. # Requirements of OS-specific install:
  7. # - install any software which is not installed by Travis configuration
  8. # - set up everything necessary so that pyenv can build python
  9. source ci/travis/travis_install.${TRAVIS_OS_NAME}.sh
  10. #############
  11. # pyenv setup
  12. #############
  13. export PYENV_ROOT="${HOME}/.pyenv"
  14. if [ ! -d "${PYENV_ROOT}/.git" ]; then
  15. git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
  16. fi
  17. pushd ${PYENV_ROOT}
  18. git fetch --tags
  19. git checkout v20160202
  20. popd
  21. export PATH="${PYENV_ROOT}/bin:${PATH}"
  22. eval "$(pyenv init -)"
  23. if [ "${YCM_PYTHON_VERSION}" == "2.6" ]; then
  24. PYENV_VERSION="2.6.6"
  25. elif [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
  26. PYENV_VERSION="2.7.6"
  27. else
  28. PYENV_VERSION="3.3.6"
  29. fi
  30. pyenv install --skip-existing ${PYENV_VERSION}
  31. pyenv rehash
  32. pyenv global ${PYENV_VERSION}
  33. # It is quite easy to get the above series of steps wrong. Verify that the
  34. # version of python actually in the path and used is the version that was
  35. # requested, and fail the build if we broke the travis setup
  36. python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_info[0], sys.version_info[1] ) )')
  37. echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
  38. test ${python_version} == ${YCM_PYTHON_VERSION}
  39. ############
  40. # pip setup
  41. ############
  42. pip install -U pip wheel setuptools
  43. pip install -r python/test_requirements.txt
  44. # The build infrastructure prints a lot of spam after this script runs, so make
  45. # sure to disable printing, and failing on non-zero exit code after this script
  46. # finishes
  47. set +ev