Skip to content

Commit 52a657a

Browse files
author
Matthias Koeppe
committed
build/bin/sage-bootstrap-python: Restore pwd checking - for WSL
1 parent 76aad01 commit 52a657a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build/bin/sage-bootstrap-python

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ SAGE_ORIG_PATH=${NEW_PATH%%':'}
3636
# a defect of sage_bootstrap on macOS regarding SSL URLs.
3737

3838
# Trac #30177: Also check for hashlib.sha1 to guard against broken python2
39-
# from old homebrew installations.
39+
# from old homebrew installations. Also check whether the current directory
40+
# is accessible by this python; this is to guard on WSL against Pythons
41+
# installed somewhere else in Windows.
4042

4143
# Trac #29285: Do not accept pythons that manipulate PATH, such as
4244
# the shims provided by pyenv.
@@ -58,7 +60,7 @@ PYTHONS="python python3 python3.12 python3.11 python3.10 python3.9 python3.8 pyt
5860
for PY in $PYTHONS; do
5961
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
6062
if [ -n "$PYTHON" ]; then
61-
if CHECK_PATH="$PATH" "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from ssl import HAS_SNI; assert HAS_SNI; from os import environ; assert environ[\"PATH\"] == environ[\"CHECK_PATH\"];" 2>/dev/null; then
63+
if CHECK_PATH="$PATH" "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from ssl import HAS_SNI; assert HAS_SNI; from os import listdir, environ; listdir(\"$(pwd)\"); assert environ[\"PATH\"] == environ[\"CHECK_PATH\"];" 2>/dev/null; then
6264
exec "$PYTHON" "$@"
6365
fi
6466
fi
@@ -67,7 +69,7 @@ done
6769
for PY in $PYTHONS; do
6870
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
6971
if [ -n "$PYTHON" ]; then
70-
if CHECK_PATH="$PATH" "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from os import environ; assert environ[\"PATH\"] == environ[\"CHECK_PATH\"];" 2>/dev/null; then
72+
if CHECK_PATH="$PATH" "$PYTHON" -c "import argparse; import urllib; from hashlib import sha1; from os import listdir, environ; listdir(\"$(pwd)\"); assert environ[\"PATH\"] == environ[\"CHECK_PATH\"];" 2>/dev/null; then
7173
exec "$PYTHON" "$@"
7274
fi
7375
fi

0 commit comments

Comments
 (0)