diff -up src/bin/sage.orig src/bin/sage --- src/bin/sage.orig 2022-09-19 16:38:18.000000000 -0600 +++ src/bin/sage 2023-01-15 17:02:57.680034236 -0700 @@ -131,7 +131,6 @@ usage() { echo " --gap [...] -- run Sage's Gap with given arguments" command -v gp &>/dev/null && \ echo " --gp [...] -- run Sage's PARI/GP calculator with given arguments" - echo " --pip [...] -- invoke pip, the Python package manager" command -v maxima &>/dev/null && \ echo " --maxima [...] -- run Sage's Maxima with given arguments" command -v mwrank &>/dev/null && \ @@ -178,60 +177,6 @@ if [ -f "${SELF}-env-config" ]; then fi ##################################################################### -# Special options to be processed without sage-env -##################################################################### - -# Check for '--nodotsage' before sourcing sage-env; otherwise sage-env -# will already have set some environment variables with the old -# setting for DOT_SAGE. -if [ "$1" = '--nodotsage' ]; then - export DOT_SAGE=`mktemp -d ${TMPDIR:-/tmp}/dotsageXXXXXX` - shift - command "${SELF}" "$@" - status=$? - rm -rf "$DOT_SAGE" - exit $status -fi - -# Check for '--patchbot' before sourcing sage-env: patchbot needs -# an unclobbered environment before testing unsafe tickets. -if [ "$1" = '-patchbot' -o "$1" = "--patchbot" ]; then - shift - # We ask the Python from Sage where the patchbot is installed. - # We set PYTHONPATH to that directory such that the system Python - # should also find the sage_patchbot package. - cmd='import sage_patchbot as p; import os; print(os.path.dirname(p.__path__[0]))' - export PYTHONPATH=`"$SAGE_ROOT/sage" --python3 -c "$cmd"` - if [ -z "$PYTHONPATH" ]; then - # Something went wrong, assume that the patchbot is not installed - echo >&2 "Error: cannot find installation path for sage_patchbot" - echo >&2 "See https://wiki.sagemath.org/buildbot for instructions" - exit 1 - fi - - shopt -s execfail # Do not exit if "exec" fails - exec python3 -m sage_patchbot.patchbot "$@" - echo >&2 "Error: cannot find a suitable Python 3 program." - echo >&2 "The SageMath patchbot requires a system Python 3 installation." - exit 127 -fi - -# Check for '-i' etc. before sourcing sage-env: running "make" -# should be run outside of the Sage shell. -case "$1" in - -i|-f|-p) - # Delegate further option handling to the non-installed sage-site script. - # (These options become unavailable if the directory $SAGE_ROOT is removed.) - if [ -d "$SAGE_ROOT" ]; then - exec "$SAGE_ROOT/build/bin/sage-site" "$@" - # fallthrough if there is no sage-site script - fi - echo >&2 "Error: unknown option: $1" - exit 1 - ;; -esac - -##################################################################### # Report information about the Sage environment ##################################################################### @@ -282,18 +227,6 @@ fi # Prepare for running Sage, either interactively or non-interactively. sage_setup() { - # Check that we're not in a source tarball which hasn't been built yet (#13561). - if [ "$SAGE_SRC_ENV_CONFIG" = 1 ] && [ ! -z "$SAGE_VENV" ] && [ ! -x "$SAGE_VENV/bin/sage" ]; then - echo >&2 '************************************************************************' - echo >&2 'It seems that you are attempting to run Sage from an unpacked source' - echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not' - echo >&2 'finished). You should run `make` in the Sage root directory first.' - echo >&2 'If you did not intend to build Sage from source, you should download' - echo >&2 'a binary tarball instead. Read README.txt for more information.' - echo >&2 '************************************************************************' - exit 1 - fi - if [ ! -d "$IPYTHONDIR" ]; then # make sure that $DOT_SAGE exists so that ipython will happily # create its config directories there. If DOT_SAGE doesn't @@ -338,8 +271,6 @@ usage_advanced() { echo " --nodotsage -- run Sage without using the user's" echo " .sage directory: create and use a temporary" echo " .sage directory instead." - echo " --gthread, --qthread, --q4thread, --wthread, --pylab" - echo " -- pass the option through to IPython" echo " --simple-prompt -- pass the option through to IPython: use" echo " this option with sage-shell mode in emacs" echo " --gdb -- run Sage under the control of gdb" @@ -369,18 +300,9 @@ usage_advanced() { echo " environment (not Sage), passing additional" echo " additional options to IPython" echo " --jupyter [...] -- run Sage's Jupyter with given arguments" - echo " --kash [...] -- run Sage's Kash with the given arguments" - command -v kash &>/dev/null || \ - echo " (not installed currently, run sage -i kash)" - echo " --M2 [...] -- run Sage's Macaulay2 with the given arguments" - command -v M2 &>/dev/null || \ - echo " (not installed currently, run sage -i macaulay2)" echo " --maxima [...] -- run Sage's Maxima with the given arguments" echo " --mwrank [...] -- run Sage's mwrank with the given arguments" - echo " --pip [...] -- invoke pip, the Python package manager" echo " --polymake [...] -- run Sage's Polymake with given arguments" - command -v polymake &>/dev/null || \ - echo " (not installed currently, run sage -i polymake)" echo " --python [...], --python3 [...]" echo " -- run the Python 3 interpreter" echo " -R [...] -- run Sage's R with the given arguments" @@ -656,11 +578,6 @@ if [ "$1" = '-lisp' -o "$1" = '--lisp' ] exec ecl "$@" fi -if [ "$1" = '-kash' -o "$1" = '--kash' ]; then - shift - exec kash "$@" -fi - if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then shift maxima_cmd=$(sage-config MAXIMA 2>/dev/null) @@ -685,11 +602,6 @@ if [ "$1" = '-R' -o "$1" = '--R' ]; then exec R "$@" fi -if [ "$1" = '-git' -o "$1" = '--git' ]; then - shift - exec git "$@" -fi - ##################################################################### # sage --sh and sage --buildsh ##################################################################### @@ -856,10 +768,6 @@ fi # build_sage, sage -b, sage -br, etc. could be moved to # build/bin/sage-site. See #29111. -build_sage() { - ( cd "$SAGE_ROOT/build/make" && ./install sagelib-no-deps ) || exit $? -} - if [[ "$1" =~ ^--notebook=.* || "$1" =~ ^-n=.* || "$1" =~ ^-notebook=.* ]] ; then sage-cleaner &>/dev/null & exec sage-notebook "$@" @@ -870,13 +778,6 @@ if [ "$1" = "-notebook" -o "$1" = '--not exec sage-notebook "$@" fi -if [ "$1" = "-bn" -o "$1" = "--build-and-notebook" ]; then - shift - build_sage - sage-cleaner &>/dev/null & - exec sage-notebook --notebook=default "$@" -fi - if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then # Source inspection facilities, supported on sage-the-distribution and on distributions # that package the Sage sources. @@ -893,46 +794,18 @@ if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; fi fi -if [ "$1" = '-b' ]; then - build_sage - exit $? -fi - -if [ "$1" = '-br' -o "$1" = "--br" ]; then - build_sage - interactive_sage -fi - if [ "$1" = '-r' ]; then shift interactive_sage fi -if [ "$1" = '-ba-force' -o "$1" = '--ba-force' ]; then - echo - echo "WARNING: 'sage --ba-force' is deprecated; use 'sage -ba' instead." - echo - ( cd "$SAGE_ROOT/build/make" && make sagelib-clean ) - build_sage - exit $? -fi - -if [ "$1" = '-ba' ]; then - ( cd "$SAGE_ROOT/build/make" && make sagelib-clean ) - build_sage - exit $? -fi - exec-runtests() { sage_setup export PYTHONIOENCODING="utf-8" # Fix encoding for doctests exec sage-runtests "$@" } -if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" = '-tp' -o "$1" = '-btp' ]; then - if [ "$1" = '-bt' -o "$1" = '-btp' ]; then - build_sage - fi +if [ "$1" = '-t' -o "$1" = '-tp' ]; then if [ "$1" = '-tp' -o "$1" = '-btp' ]; then shift exec-runtests -p "$@" @@ -942,34 +815,11 @@ if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" fi fi -if [ "$1" = '-tnew' -o "$1" = '-btnew' ]; then - if [ "$1" = '-btnew' ]; then - build_sage - fi - shift - exec-runtests --new "$@" -fi - if [ "$1" = '-testall' -o "$1" = "--testall" ]; then shift exec-runtests -a "$@" fi -if [ "$1" = '-fixdoctests' -o "$1" = '--fixdoctests' ]; then - shift - exec sage-fixdoctests "$@" -fi - -if [ "$1" = "-coverage" -o "$1" = "--coverage" ]; then - shift - exec sage-coverage "$@" -fi - -if [ "$1" = "-coverageall" -o "$1" = "--coverageall" ]; then - shift - exec sage-coverage --all "$@" -fi - if [ "$1" = '-startuptime' -o "$1" = '--startuptime' ]; then exec sage-startuptime.py "$@" fi @@ -1056,11 +906,6 @@ if [ "$1" = '-installed' -o "$1" = "--in exec sage-list-packages all --installed-only $@ fi -if [ "$1" = '-sdist' -o "$1" = "--sdist" ]; then - shift - exec sage-sdist "$@" -fi - ##################################################################### # Debugging tools ##################################################################### @@ -1110,12 +955,6 @@ if [ "$1" = '-callgrind' -o "$1" = "--ca exec sage-callgrind "$@" fi -if [ "$1" = '-omega' -o "$1" = "--omega" ]; then - shift - sage_setup - exec sage-omega "$@" -fi - if [ "$1" = '-gthread' -o "$1" = '-qthread' -o "$1" = '-q4thread' -o "$1" = '-wthread' -o "$1" = '-pylab' -o "$1" = '--simple-prompt' -o "$1" = '-simple-prompt' ]; then # Intentionally no "shift" here interactive_sage "$@"