fix: Fixing some small issues with the build script after updating mac OS

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
Francisco Javier Arceo 2025-02-18 05:49:28 -05:00
parent 6b1773d530
commit 51746acd8e
2 changed files with 14 additions and 10 deletions

View file

@ -44,7 +44,7 @@ NC='\033[0m' # No Color
# this is set if we actually create a new conda in which case we need to clean up # this is set if we actually create a new conda in which case we need to clean up
ENVNAME="" ENVNAME=""
SCRIPT_DIR=$(dirname "$(readlink -f "$0")") SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
source "$SCRIPT_DIR/common.sh" source "$SCRIPT_DIR/common.sh"
# pre-run checks to make sure we can proceed with the installation # pre-run checks to make sure we can proceed with the installation

View file

@ -10,12 +10,12 @@ cleanup() {
set +x set +x
echo "Cleaning up..." echo "Cleaning up..."
conda deactivate conda deactivate
conda env remove --name $envname -y conda env remove --name "$envname" -y
} }
handle_int() { handle_int() {
if [ -n $ENVNAME ]; then if [ -n "$ENVNAME" ]; then
cleanup $ENVNAME cleanup "$ENVNAME"
fi fi
exit 1 exit 1
} }
@ -23,8 +23,8 @@ handle_int() {
handle_exit() { handle_exit() {
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "\033[1;31mABORTING.\033[0m" echo -e "\033[1;31mABORTING.\033[0m"
if [ -n $ENVNAME ]; then if [ -n "$ENVNAME" ]; then
cleanup $ENVNAME cleanup "$ENVNAME"
fi fi
fi fi
} }
@ -33,10 +33,14 @@ setup_cleanup_handlers() {
trap handle_int INT trap handle_int INT
trap handle_exit EXIT trap handle_exit EXIT
__conda_setup="$('conda' 'shell.bash' 'hook' 2>/dev/null)" if is_command_available conda; then
eval "$__conda_setup" __conda_setup="$('conda' 'shell.bash' 'hook' 2>/dev/null)"
eval "$__conda_setup"
conda deactivate conda deactivate
else
echo "conda is not available"
exit 1
fi
} }
# check if a command is present # check if a command is present