Skip to content

Commit

Permalink
Merge pull request NOAA-GFDL#521 from jtmims/main
Browse files Browse the repository at this point in the history
remove old conda envs if found on build
  • Loading branch information
wrongkindofdoctor authored Mar 26, 2024
2 parents c21ef23 + 22cebaa commit eb46c7c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/conda/conda_env_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,15 @@ if [ "$make_envs" = "true" ]; then
else
conda_prefix="${_CONDA_ENV_ROOT}/${env_name}"
fi
echo "$conda_prefix"
if [ -d "$conda_prefix" ]; then
# remove conda env of same name
echo "Removing previous conda env ${env_name}..."
conda remove -q -y -n "$env_name" --all
echo "... previous env ${env_name} removed."
fi
echo "Creating conda env ${env_name} in ${conda_prefix}..."
"$_INSTALL_EXE" env create --force -q -p="$conda_prefix" -f="$env_file"
"$_INSTALL_EXE" env create -q -p="$conda_prefix" -f="$env_file"
echo "... conda env ${env_name} created."
done
"$_INSTALL_EXE" clean -aqy
Expand Down Expand Up @@ -196,4 +203,4 @@ fi
echo "\"\${_mdtf}/mdtf_framework.py\" \"\$@\"" >> "$_CONDA_WRAPPER"
echo "exit \$?" >> "$_CONDA_WRAPPER"
chmod +x "$_CONDA_WRAPPER"
echo "Created MDTF wrapper script at ${_CONDA_WRAPPER}"
echo "Created MDTF wrapper script at ${_CONDA_WRAPPER}"

0 comments on commit eb46c7c

Please sign in to comment.