Skip to content

Commit

Permalink
Updated install script to look like other projects, removed environme…
Browse files Browse the repository at this point in the history
…nt file.
  • Loading branch information
mhearne-usgs committed Nov 28, 2018
1 parent 0e3d6cb commit ade1655
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 45 deletions.
21 changes: 0 additions & 21 deletions environment.yml

This file was deleted.

50 changes: 26 additions & 24 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ echo $PATH

VENV=comcat

# Is the reset flag set?
reset=0
while getopts r FLAG; do
case $FLAG in
r)
reset=1

;;
esac
done


# create a matplotlibrc file with the non-interactive backend "Agg" in it.
if [ ! -d "$matplotlibdir" ]; then
mkdir -p $matplotlibdir
Expand Down Expand Up @@ -77,23 +65,40 @@ echo ""


# Choose an environment file based on platform
echo ". $HOME/miniconda/etc/profile.d/conda.sh" >> $prof

# 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
# only add this line if it does not already exist
grep "/etc/profile.d/conda.sh" $prof
if [ $? -ne 0 ]; then
echo ". $_CONDA_ROOT/etc/profile.d/conda.sh" >> $prof
fi

# Start in conda base environment
echo "Activate base virtual environment"
conda activate base

# Remove existing libcomcat environment if it exists
conda remove -y -n $VENV --all

# Package list:
package_list=(
"python=3.5"
"impactutils"
"ipython"
"jupyter"
"numpy"
"obspy"
"pandas"
"pytest"
"pytest-cov"
"vcrpy"
"xlrd"
"xlwt"
"openpyxl"
"xlsxwriter"
)

# Create a conda virtual environment
echo "Creating the $VENV virtual environment:"
conda env create -f $env_file --force
conda create -y -n $VENV -c conda-forge --channel-priority ${package_list[*]}

# Bail out at this point if the conda create command fails.
# Clean up zip files we've downloaded
Expand All @@ -111,8 +116,5 @@ conda activate $VENV
echo "Installing libcomcat..."
pip install -e .

# Install default profile
#python bin/sm_profile -c default -a

# Tell the user they have to activate this environment
echo "Type 'conda activate $VENV' to use this new virtual environment."

0 comments on commit ade1655

Please sign in to comment.