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

Commit

Permalink
src/bin/sage: Use python3 etc. from PATH instead of using SAGE_LOCAL
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Nov 12, 2020
1 parent 8f88709 commit ab2655e
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ sage_setup() {
# if Python and sage-location haven't been installed yet.
maybe_sage_location()
{
if [ -w "$SAGE_LOCAL" ]; then
if [ -n "$SAGE_LOCAL" -a -w "$SAGE_LOCAL" ]; then
if [ -x "$SAGE_LOCAL/bin/python" ] && [ -x "$SAGE_LOCAL/bin/sage-location" ]; then
sage-location || exit $?
fi
Expand Down Expand Up @@ -520,39 +520,24 @@ fi
# Run Sage's versions of Python, pip, IPython, Jupyter.
#####################################################################

if [ "$1" = '-pip' -o "$1" = '--pip' ]; then
if [ "$1" = '-pip' -o "$1" = '--pip' -o "$1" = "--pip3" ]; then
shift
exec sage-python -m pip "$@"
exec python3 -m pip "$@"
fi

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

if [ "$1" = '-python' -o "$1" = '--python' ]; then
if [ "$1" = '-ipython' -o "$1" = '--ipython' -o "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then
shift
exec "$SAGE_LOCAL"/bin/python3 "$@"
fi

if [ "$1" = '-python3' -o "$1" = '--python3' ]; then
shift
exec "$SAGE_LOCAL"/bin/python3 "$@"
fi

if [ "$1" = '-ipython' -o "$1" = '--ipython' ]; then
shift
exec "$SAGE_LOCAL"/bin/ipython "$@"
fi

if [ "$1" = '-ipython3' -o "$1" = '--ipython3' ]; then
shift
exec "$SAGE_LOCAL"/bin/ipython3 "$@"
exec ipython3 "$@"
fi

if [ "$1" = '-jupyter' -o "$1" = '--jupyter' ]; then
shift
exec "$SAGE_LOCAL"/bin/jupyter "$@"
exec jupyter "$@"
fi

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

0 comments on commit ab2655e

Please sign in to comment.