Skip to content

Commit

Permalink
build/bin/sage-bootstrap-python: Prefer a Python that provides ssl wi…
Browse files Browse the repository at this point in the history
…th SNI
  • Loading branch information
Matthias Koeppe committed Nov 7, 2021
1 parent f716a0b commit 48b7927
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build/bin/sage-bootstrap-python
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@ if [ "$LC_ALL" = "C" -o "$LANG" = "C" -o "$LC_CTYPE" = "C" ]; then
export LANG
fi

PYTHONS="python python3 python3.8 python3.7 python2.7 python3.6 python2"
PYTHONS="python python3 python3.10 python3.9 python3.8 python3.7 python2.7 python3.6 python2"
# Trac #32405: Prefer a Python that provides ssl with SNI, which allows developers
# to download from upstream URLs (configure --enable-download-from-upstream-url),
# in particular from PyPI, which requires SNI.
for PY in $PYTHONS; do
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
if [ -n "$PYTHON" ]; then
if "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from ssl import HAS_SNI; assert HAS_SNI; from os import listdir; listdir(\"$(pwd)\");" 2>/dev/null; then
exec "$PYTHON" "$@"
fi
fi
done
# Second round, no ssl/SNI test.
for PY in $PYTHONS; do
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
if [ -n "$PYTHON" ]; then
Expand Down

0 comments on commit 48b7927

Please sign in to comment.