From ead35301e12e61fa5e88ddf3f9bedd9e90ddf703 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Tue, 13 Jun 2023 22:34:27 +0200 Subject: [PATCH 1/2] Fail on errors in `bootstrap.sh` --- bootstrap.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5869de656f..fa33ce008a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -33,6 +33,7 @@ usage() echo "Bootstrap ReFrame by pulling all its dependencies" echo " -P EXEC Use EXEC as Python interpreter" echo " -h Print this help message and exit" + echo " --ignore-errors Ignore installation errors" echo " --pip-opts Pass additional options to pip." echo " +docs Build also the documentation" echo " +pygelf Install also the pygelf Python package" @@ -43,17 +44,22 @@ while getopts "hP:-:" opt; do case $opt in "P") python=$OPTARG ;; "h") usage && exit 0 ;; - "-") - case "${OPTARG}" in + "-") + case "${OPTARG}" in + "ignore-errors") ignore_errors=1 ;; pip-opts) - PIPOPTS="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) ;; - pip-opts=*) + PIPOPTS="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) ;; + pip-opts=*) PIPOPTS=${OPTARG#*=} ;; esac;; "?") usage && exit 0 ;; esac done +if [ -z $ignore_errors ]; then + set -e +fi + shift $((OPTIND - 1)) if [ -z $python ]; then python=python3 From 39b1be6b62d253efd4847d7838153415d9b241b7 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Tue, 13 Jun 2023 23:23:19 +0200 Subject: [PATCH 2/2] Better check for ensurepip existence --- bootstrap.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index fa33ce008a..f87027d4a1 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -88,16 +88,13 @@ fi export PIP_USER=0 # Check if ensurepip is installed -$python -m ensurepip --version &> /dev/null -epip=$? - -export PATH=$(pwd)/external/usr/bin:$PATH - -# Install pip for Python 3 -if [ $epip -eq 0 ]; then +if $python -m ensurepip --version &> /dev/null; then + # Install pip for Python 3 CMD $python -m ensurepip --root $(pwd)/external/ --default-pip fi +export PATH=$(pwd)/external/usr/bin:$PATH + # ensurepip installs pip in `external/usr/` whereas the `--root` option installs # everything under `external/`. That's why we include both in the PYTHONPATH