|
| 1 | +#!/bin/zsh |
| 2 | +######################################################################## |
| 3 | +# check if conda is available |
| 4 | +# check that diff_check environment is available |
| 5 | +# activate it |
| 6 | +######################################################################## |
| 7 | + |
| 8 | +# Check if conda command is available |
| 9 | +echo "Checking if conda command is available..." |
| 10 | +if ! command -v conda >/dev/null 2>&1; then |
| 11 | + echo "conda command not found, you won't be able to build the python wrap for diffcheck. Please install Anaconda or Miniconda first." |
| 12 | + exit 1 |
| 13 | +fi |
| 14 | +echo "Conda command is available." |
| 15 | + |
| 16 | +# Check if the diff_check environment is available |
| 17 | +if ! conda env list | grep -q 'diff_check'; then |
| 18 | + echo "diff_check environment not found, you should create one by running:" |
| 19 | + echo "$ conda env create -f environment.mac.yml" |
| 20 | + exit 1 |
| 21 | +else |
| 22 | + echo "diff_check environment is available, updating it now..." |
| 23 | + if conda env update --name diff_check --file environment.mac.yml --prune; then |
| 24 | + echo "Environment updated successfully." |
| 25 | + else |
| 26 | + echo "Failed to update diff_check environment, please check the environment.mac.yml file." |
| 27 | + exit 1 |
| 28 | + fi |
| 29 | +fi |
| 30 | +echo "diff_check environment is up to date." |
| 31 | + |
| 32 | +# Check if a different environment than diff_check is activated, if so deactivate it |
| 33 | +active_env_name=$(conda info --envs | awk '/\*/ {print $1}') |
| 34 | +if [[ "$active_env_name" != "diff_check" && -n "$active_env_name" ]]; then |
| 35 | + echo "You should deactivate $active_env_name first with 'conda deactivate' and 'conda activate diff_check' before running this script." |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | + |
| 39 | +echo "You can start the cmake config now ..." |
0 commit comments