Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
build/bin/sage-bootstrap-python: Test that python has argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Mar 4, 2021
1 parent 5500d19 commit 0f3d369
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/bin/sage-bootstrap-python
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ fi
# So it needs to find a python that has the urllib module.
# For example, on Debian buster, the python3-minimal package does NOT provide it.
#
# Also, Trac #20023 removed the vendored argparse library from sage_bootstrap,
# so we test that python is new enough (>= 2.7) to run it.
#
# See https://trac.sagemath.org/ticket/29090

# Trac #29890: Our first choice is "python", not "python3". This is to avoid
Expand All @@ -41,7 +44,7 @@ PYTHONS="python python3 python3.8 python3.7 python2.7 python3.6 python2"
for PY in $PYTHONS; do
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
if [ -n "$PYTHON" ]; then
if "$PYTHON" -c "import urllib; from hashlib import sha1; from os import listdir; listdir(\"$(pwd)\");" 2>/dev/null; then
if "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from os import listdir; listdir(\"$(pwd)\");" 2>/dev/null; then
exec "$PYTHON" "$@"
fi
fi
Expand Down

0 comments on commit 0f3d369

Please sign in to comment.