travis_install.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. # DON'T exit if error
  14. set +e
  15. git clone https://github.com/yyuu/pyenv.git ~/.pyenv
  16. git fetch --tags
  17. git checkout v20160202
  18. # Exit if error
  19. set -e
  20. export PYENV_ROOT="$HOME/.pyenv"
  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