2015-11-08 15:21:30 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ev
|
|
|
|
|
2017-11-29 13:34:53 -05:00
|
|
|
# RVM overrides the cd, popd, and pushd shell commands, causing the
|
|
|
|
# "shell_session_update: command not found" error on macOS when executing those
|
|
|
|
# commands.
|
|
|
|
unset -f cd popd pushd
|
|
|
|
|
2018-01-18 08:23:17 -05:00
|
|
|
################
|
|
|
|
# Compiler setup
|
|
|
|
################
|
2015-11-08 15:21:30 -05:00
|
|
|
|
2018-01-18 08:23:17 -05:00
|
|
|
# We can't use sudo, so we have to approximate the behaviour of setting the
|
|
|
|
# default system compiler.
|
2015-11-08 15:21:30 -05:00
|
|
|
|
2018-01-18 08:23:17 -05:00
|
|
|
mkdir -p ${HOME}/bin
|
|
|
|
|
|
|
|
ln -s /usr/bin/g++-4.8 ${HOME}/bin/c++
|
|
|
|
ln -s /usr/bin/gcc-4.8 ${HOME}/bin/cc
|
|
|
|
|
|
|
|
export PATH=${HOME}/bin:${PATH}
|
|
|
|
|
|
|
|
##############
|
|
|
|
# Python setup
|
|
|
|
##############
|
2015-11-08 15:21:30 -05:00
|
|
|
|
2017-09-05 14:36:50 -04:00
|
|
|
PYENV_ROOT="${HOME}/.pyenv"
|
2016-04-15 05:28:42 -04:00
|
|
|
|
2016-04-17 05:01:12 -04:00
|
|
|
if [ ! -d "${PYENV_ROOT}/.git" ]; then
|
2017-09-05 14:36:50 -04:00
|
|
|
rm -rf ${PYENV_ROOT}
|
2016-04-15 05:28:42 -04:00
|
|
|
git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
|
|
|
|
fi
|
|
|
|
pushd ${PYENV_ROOT}
|
2016-04-17 05:01:12 -04:00
|
|
|
git fetch --tags
|
2018-01-24 11:54:57 -05:00
|
|
|
git checkout v1.2.1
|
2016-04-15 05:28:42 -04:00
|
|
|
popd
|
2016-02-28 21:10:49 -05:00
|
|
|
|
2016-04-15 05:28:42 -04:00
|
|
|
export PATH="${PYENV_ROOT}/bin:${PATH}"
|
2016-02-28 21:10:49 -05:00
|
|
|
|
|
|
|
eval "$(pyenv init -)"
|
|
|
|
|
2018-01-24 11:54:57 -05:00
|
|
|
if [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
|
|
|
|
PYENV_VERSION="2.7.14"
|
2016-02-28 21:10:49 -05:00
|
|
|
else
|
2018-01-24 11:54:57 -05:00
|
|
|
PYENV_VERSION="3.4.7"
|
2016-02-28 21:10:49 -05:00
|
|
|
fi
|
|
|
|
|
2018-01-18 08:23:17 -05:00
|
|
|
# In order to work with ycmd, python *must* be built as a shared library. This
|
|
|
|
# is set via the PYTHON_CONFIGURE_OPTS option.
|
|
|
|
export PYTHON_CONFIGURE_OPTS="--enable-shared"
|
|
|
|
|
2016-02-28 21:10:49 -05:00
|
|
|
pyenv install --skip-existing ${PYENV_VERSION}
|
|
|
|
pyenv rehash
|
|
|
|
pyenv global ${PYENV_VERSION}
|
2015-11-08 15:21:30 -05:00
|
|
|
|
|
|
|
# It is quite easy to get the above series of steps wrong. Verify that the
|
|
|
|
# version of python actually in the path and used is the version that was
|
|
|
|
# requested, and fail the build if we broke the travis setup
|
2016-02-28 21:10:49 -05:00
|
|
|
python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_info[0], sys.version_info[1] ) )')
|
|
|
|
echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
|
|
|
|
test ${python_version} == ${YCM_PYTHON_VERSION}
|
|
|
|
|
2015-11-08 15:21:30 -05:00
|
|
|
pip install -U pip wheel setuptools
|
|
|
|
pip install -r python/test_requirements.txt
|
|
|
|
|
|
|
|
# The build infrastructure prints a lot of spam after this script runs, so make
|
|
|
|
# sure to disable printing, and failing on non-zero exit code after this script
|
|
|
|
# finishes
|
|
|
|
set +ev
|