refactor(testing): make setup_env.sh runnable only from within /testing
This commit is contained in:
@@ -4,19 +4,6 @@
|
|||||||
ENV_NAME="propeller-protocol-lib-testing"
|
ENV_NAME="propeller-protocol-lib-testing"
|
||||||
PYTHON_VERSION="3.9"
|
PYTHON_VERSION="3.9"
|
||||||
REQUIREMENTS_FILE="requirements.txt"
|
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
|
# Create conda environment
|
||||||
echo "Creating conda environment ${ENV_NAME} with Python ${PYTHON_VERSION}..."
|
echo "Creating conda environment ${ENV_NAME} with Python ${PYTHON_VERSION}..."
|
||||||
@@ -27,9 +14,9 @@ echo "Activating the environment..."
|
|||||||
source activate $ENV_NAME
|
source activate $ENV_NAME
|
||||||
|
|
||||||
# Install the requirements
|
# Install the requirements
|
||||||
echo "Installing the requirements from ${SCRIPT_DIR}/${REQUIREMENTS_FILE}..."
|
echo "Installing the requirements from ${REQUIREMENTS_FILE}..."
|
||||||
./${SCRIPT_DIR}/${PRE_BUILD_SCRIPT}
|
./pre_build.sh
|
||||||
pip install -r ${SCRIPT_DIR}/${REQUIREMENTS_FILE}
|
pip install -r $REQUIREMENTS_FILE
|
||||||
conda activate $ENV_NAME
|
conda activate $ENV_NAME
|
||||||
|
|
||||||
echo "Setup complete."
|
echo "Setup complete."
|
||||||
Reference in New Issue
Block a user