From c7b1796f7d58bf1704ca0df1c311a1ee097afd16 Mon Sep 17 00:00:00 2001 From: Florian Pellissier <111426680+flopell@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:07:34 +0200 Subject: [PATCH] refactor(testing): make setup_env.sh runnable only from within `/testing` --- testing/setup_env.sh | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/testing/setup_env.sh b/testing/setup_env.sh index bd80b67..2bdf3d8 100755 --- a/testing/setup_env.sh +++ b/testing/setup_env.sh @@ -4,19 +4,6 @@ ENV_NAME="propeller-protocol-lib-testing" PYTHON_VERSION="3.9" REQUIREMENTS_FILE="requirements.txt" -PRE_BUILD_SCRIPT="pre_build.sh" - -# Allow to run either from root or from inside testing folder. -if [ -f "./$REQUIREMENTS_FILE" ]; then - # If the requirements file is found in the current directory, do nothing - SCRIPT_DIR="." -elif [ -f "testing/$REQUIREMENTS_FILE" ]; then - # If the requirements file is found in testing/, adjust the paths - SCRIPT_DIR="testing" -else - echo "Error: Script must be run from the propeller-protocol-lib or propeller-protocol-lib/testing directory." - exit 1 -fi # Create conda environment echo "Creating conda environment ${ENV_NAME} with Python ${PYTHON_VERSION}..." @@ -27,9 +14,9 @@ echo "Activating the environment..." source activate $ENV_NAME # Install the requirements -echo "Installing the requirements from ${SCRIPT_DIR}/${REQUIREMENTS_FILE}..." -./${SCRIPT_DIR}/${PRE_BUILD_SCRIPT} -pip install -r ${SCRIPT_DIR}/${REQUIREMENTS_FILE} +echo "Installing the requirements from ${REQUIREMENTS_FILE}..." +./pre_build.sh +pip install -r $REQUIREMENTS_FILE conda activate $ENV_NAME echo "Setup complete." \ No newline at end of file