Skip to content

Commit fe49f64

Browse files
authored
Merge pull request #2925 from vkarak/packaging/bootstrap-fail-on-error
[packaging] Fail on errors in `bootstrap.sh` and add a new `--ignore-errors` option
2 parents d116224 + 39b1be6 commit fe49f64

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

bootstrap.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ usage()
3333
echo "Bootstrap ReFrame by pulling all its dependencies"
3434
echo " -P EXEC Use EXEC as Python interpreter"
3535
echo " -h Print this help message and exit"
36+
echo " --ignore-errors Ignore installation errors"
3637
echo " --pip-opts Pass additional options to pip."
3738
echo " +docs Build also the documentation"
3839
echo " +pygelf Install also the pygelf Python package"
@@ -43,17 +44,22 @@ while getopts "hP:-:" opt; do
4344
case $opt in
4445
"P") python=$OPTARG ;;
4546
"h") usage && exit 0 ;;
46-
"-")
47-
case "${OPTARG}" in
47+
"-")
48+
case "${OPTARG}" in
49+
"ignore-errors") ignore_errors=1 ;;
4850
pip-opts)
49-
PIPOPTS="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) ;;
50-
pip-opts=*)
51+
PIPOPTS="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) ;;
52+
pip-opts=*)
5153
PIPOPTS=${OPTARG#*=} ;;
5254
esac;;
5355
"?") usage && exit 0 ;;
5456
esac
5557
done
5658

59+
if [ -z $ignore_errors ]; then
60+
set -e
61+
fi
62+
5763
shift $((OPTIND - 1))
5864
if [ -z $python ]; then
5965
python=python3
@@ -82,16 +88,13 @@ fi
8288
export PIP_USER=0
8389

8490
# Check if ensurepip is installed
85-
$python -m ensurepip --version &> /dev/null
86-
epip=$?
87-
88-
export PATH=$(pwd)/external/usr/bin:$PATH
89-
90-
# Install pip for Python 3
91-
if [ $epip -eq 0 ]; then
91+
if $python -m ensurepip --version &> /dev/null; then
92+
# Install pip for Python 3
9293
CMD $python -m ensurepip --root $(pwd)/external/ --default-pip
9394
fi
9495

96+
export PATH=$(pwd)/external/usr/bin:$PATH
97+
9598
# ensurepip installs pip in `external/usr/` whereas the `--root` option installs
9699
# everything under `external/`. That's why we include both in the PYTHONPATH
97100

0 commit comments

Comments
 (0)