forked from MolSSI/cookiecutter-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbefore_install.sh
More file actions
executable file
·54 lines (53 loc) · 2.19 KB
/
before_install.sh
File metadata and controls
executable file
·54 lines (53 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Temporarily change directory to $HOME to install software
pushd .
cd $HOME
# Make sure some level of pip is installed
python -m ensurepip
{% if (cookiecutter.dependency_source == 'Prefer conda-forge over the default anaconda channel with pip fallback' or cookiecutter.dependency_source == 'Prefer default anaconda channel with pip fallback') %}
# Install Miniconda
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
# Make OSX md5 mimic md5sum from linux, alias does not work
md5sum () {
command md5 -r "$@"
}
MINICONDA=Miniconda3-latest-MacOSX-x86_64.sh
else
MINICONDA=Miniconda3-latest-Linux-x86_64.sh
fi
MINICONDA_HOME=$HOME/miniconda
MINICONDA_MD5=$(curl -s https://repo.continuum.io/miniconda/ | grep -A3 $MINICONDA | sed -n '4p' | sed -n 's/ *<td>\(.*\)<\/td> */\1/p')
wget -q https://repo.continuum.io/miniconda/$MINICONDA
if [[ $MINICONDA_MD5 != $(md5sum $MINICONDA | cut -d ' ' -f 1) ]]; then
echo "Miniconda MD5 mismatch"
exit 1
fi
bash $MINICONDA -b -p $MINICONDA_HOME
# Configure miniconda
export PIP_ARGS="-U"
# New to conda >=4.4
echo ". $MINICONDA_HOME/etc/profile.d/conda.sh" >> ~/.bashrc # Source the profile.d file
echo "conda activate" >> ~/.bashrc # Activate conda
source ~/.bashrc # source file to get new commands
#export PATH=$MINICONDA_HOME/bin:$PATH # Old way, should not be needed anymore
{% if cookiecutter.dependency_source == "Prefer conda-forge over the default anaconda channel with pip fallback" %}
conda config --add channels conda-forge
{% endif %}
conda config --set always_yes yes
conda install conda conda-build jinja2 anaconda-client
conda update --quiet --all
{% elif cookiecutter.dependency_source == 'Dependencies from pip only (no conda)' %}
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade pyenv
# Pyenv requires minor revision, get the latest
PYENV_VERSION=$(pyenv install --list |grep $PYTHON_VER | sed -n "s/^[ \t]*\(${PYTHON_VER}\.*[0-9]*\).*/\1/p" | tail -n 1)
# Install version
pyenv install $PYENV_VERSION
# Use version for this
pyenv global $PYENV_VERSION
# Setup up path shims
eval "$(pyenv init -)"
fi
pip install --upgrade pip setuptools
{% endif %}
# Restore original directory
popd