forked from usgs/earthquake-ted
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·71 lines (56 loc) · 1.73 KB
/
install.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
echo "Path:"
echo $PATH
VENV=ted
# Is the reset flag set?
reset=0
while getopts r FLAG; do
case $FLAG in
r)
reset=1
;;
esac
done
# Is conda installed?
conda=$(which conda)
if [ ! "$conda" ] ; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
-O miniconda.sh;
bash miniconda.sh -f -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
fi
# Choose an environment file based on platform
# unamestr=`uname`
# if [ "$unamestr" == 'Linux' ]; then
# env_file=environment_linux.yml
# elif [ "$unamestr" == 'FreeBSD' ] || [ "$unamestr" == 'Darwin' ]; then
# env_file=environment_osx.yml
# fi
# If the user has specified the -r (reset) flag, then create an
# environment based on only the named dependencies, without
# any versions of packages specified.
# if [ $reset == 1 ]; then
# echo "Ignoring platform, letting conda sort out dependencies..."
# env_file=environment.yml
# fi
env_file=environment.yml
# Turn off whatever other virtual environment user might be in
source deactivate
# Create a conda virtual environment
echo "Creating the $VENV virtual environment:"
conda env create -f $env_file --force
# Bail out at this point if the conda create command fails.
# Clean up zip files we've downloaded
if [ $? -ne 0 ]; then
echo "Failed to create conda environment. Resolve any conflicts, then try again."
echo "Cleaning up zip files..."
exit
fi
# Activate the new environment
echo "Activating the $VENV virtual environment"
source activate $VENV
# This package
echo "Installing ted..."
pip install -e .
# Tell the user they have to activate this environment
echo "Type 'source activate $VENV' to use this new virtual environment."