travis_install.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. PYENV_ROOT="${HOME}/.pyenv"
  14. if [ ! -d "${PYENV_ROOT}/.git" ]; then
  15. rm -rf ${PYENV_ROOT}
  16. git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
  17. fi
  18. pushd ${PYENV_ROOT}
  19. git fetch --tags
  20. git checkout v1.0.8
  21. popd
  22. export PATH="${PYENV_ROOT}/bin:${PATH}"
  23. eval "$(pyenv init -)"
  24. if [ "${YCM_PYTHON_VERSION}" == "2.6" ]; then
  25. PYENV_VERSION="2.6.6"
  26. elif [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
  27. PYENV_VERSION="2.7.6"
  28. else
  29. PYENV_VERSION="3.3.6"
  30. fi
  31. pyenv install --skip-existing ${PYENV_VERSION}
  32. pyenv rehash
  33. pyenv global ${PYENV_VERSION}
  34. # It is quite easy to get the above series of steps wrong. Verify that the
  35. # version of python actually in the path and used is the version that was
  36. # requested, and fail the build if we broke the travis setup
  37. python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_info[0], sys.version_info[1] ) )')
  38. echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
  39. test ${python_version} == ${YCM_PYTHON_VERSION}
  40. ############
  41. # pip setup
  42. ############
  43. pip install -U pip wheel setuptools
  44. pip install -r python/test_requirements.txt
  45. # The build infrastructure prints a lot of spam after this script runs, so make
  46. # sure to disable printing, and failing on non-zero exit code after this script
  47. # finishes
  48. set +ev