From 30a6e113638d195092d67c3fcd792a3f1825df32 Mon Sep 17 00:00:00 2001 From: kayibal Date: Tue, 29 Apr 2025 12:03:34 +0100 Subject: [PATCH] Fix testing env stup script - Fails now if any command errors - Conda environment activation is more stable now --- testing/setup_env.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/testing/setup_env.sh b/testing/setup_env.sh index f67b948..525dbd8 100755 --- a/testing/setup_env.sh +++ b/testing/setup_env.sh @@ -1,13 +1,14 @@ #!/bin/bash # To run: ./setup_env.sh +set -e command_exists() { command -v "$1" >/dev/null 2>&1 } # Check each dependency is installed -local deps=("git" "rustc" "gcc" "openssl" "conda" "pip" "pg_config") -local names=("git" "rust" "gcc" "openssl" "conda" "pip" "libpq") +deps=("git" "rustc" "gcc" "openssl" "conda" "pip" "pg_config") +names=("git" "rust" "gcc" "openssl" "conda" "pip" "libpq") for i in "${!deps[@]}"; do if ! command_exists "${deps[$i]}"; then echo "Error: '${names[$i]}' is not installed." @@ -31,7 +32,8 @@ conda create --name $ENV_NAME python=$PYTHON_VERSION -y # Activate the environment echo "Activating the environment..." -source activate $ENV_NAME +eval "$(conda shell.bash hook)" +conda activate $ENV_NAME # Install the requirements echo "Installing the requirements from ${REQUIREMENTS_FILE}..." @@ -40,4 +42,4 @@ conda activate $ENV_NAME echo "----------------------------------------" echo "SETUP COMPLETE." -echo "Run 'conda activate $ENV_NAME' to activate the environment." \ No newline at end of file +echo "Run 'conda activate $ENV_NAME' to activate the environment."