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

Commit ab2655e

Browse files
author
Matthias Koeppe
committed
src/bin/sage: Use python3 etc. from PATH instead of using SAGE_LOCAL
1 parent 8f88709 commit ab2655e

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

src/bin/sage

+9-24
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ sage_setup() {
250250
# if Python and sage-location haven't been installed yet.
251251
maybe_sage_location()
252252
{
253-
if [ -w "$SAGE_LOCAL" ]; then
253+
if [ -n "$SAGE_LOCAL" -a -w "$SAGE_LOCAL" ]; then
254254
if [ -x "$SAGE_LOCAL/bin/python" ] && [ -x "$SAGE_LOCAL/bin/sage-location" ]; then
255255
sage-location || exit $?
256256
fi
@@ -520,39 +520,24 @@ fi
520520
# Run Sage's versions of Python, pip, IPython, Jupyter.
521521
#####################################################################
522522

523-
if [ "$1" = '-pip' -o "$1" = '--pip' ]; then
523+
if [ "$1" = '-pip' -o "$1" = '--pip' -o "$1" = "--pip3" ]; then
524524
shift
525-
exec sage-python -m pip "$@"
525+
exec python3 -m pip "$@"
526526
fi
527527

528-
if [ "$1" = '--pip3' ]; then
528+
if [ "$1" = '-python' -o "$1" = '--python' -o "$1" = '-python3' -o "$1" = '--python3' ]; then
529529
shift
530-
exec "$SAGE_LOCAL"/bin/python3 -m pip "$@"
530+
exec python3 "$@"
531531
fi
532532

533-
if [ "$1" = '-python' -o "$1" = '--python' ]; then
533+
if [ "$1" = '-ipython' -o "$1" = '--ipython' -o "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then
534534
shift
535-
exec "$SAGE_LOCAL"/bin/python3 "$@"
536-
fi
537-
538-
if [ "$1" = '-python3' -o "$1" = '--python3' ]; then
539-
shift
540-
exec "$SAGE_LOCAL"/bin/python3 "$@"
541-
fi
542-
543-
if [ "$1" = '-ipython' -o "$1" = '--ipython' ]; then
544-
shift
545-
exec "$SAGE_LOCAL"/bin/ipython "$@"
546-
fi
547-
548-
if [ "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then
549-
shift
550-
exec "$SAGE_LOCAL"/bin/ipython3 "$@"
535+
exec ipython3 "$@"
551536
fi
552537

553538
if [ "$1" = '-jupyter' -o "$1" = '--jupyter' ]; then
554539
shift
555-
exec "$SAGE_LOCAL"/bin/jupyter "$@"
540+
exec jupyter "$@"
556541
fi
557542

558543
#####################################################################
@@ -976,7 +961,7 @@ install() {
976961
done
977962
# Display a message if we actually installed something (using this
978963
# file, generated by sage-spkg, is a bit of a hack though)
979-
if [ -f "$SAGE_LOCAL/lib/sage-force-relocate.txt" ]; then
964+
if [ -n "$SAGE_LOCAL" -a -f "$SAGE_LOCAL/lib/sage-force-relocate.txt" ]; then
980965
echo
981966
echo "Warning: it might be needed to update the Sage library before"
982967
echo "installed packages work: you should run 'make' from \$SAGE_ROOT"

0 commit comments

Comments
 (0)