@@ -193,6 +193,13 @@ if [ "$1" = '--nodotsage' ]; then
193193 exit $status
194194fi
195195
196+ # build_sage, sage -b, sage -br, etc. could also be moved to
197+ # build/bin/sage-site. See #29111; but OTOH #34627.
198+
199+ build_sage () {
200+ ( cd " $SAGE_ROOT " && make sagelib-no-deps ) || exit $?
201+ }
202+
196203# Check for '-i' etc. before sourcing sage-env: running "make"
197204# should be run outside of the Sage shell.
198205case " $1 " in
@@ -206,6 +213,28 @@ case "$1" in
206213 echo >&2 " Error: unknown option: $1 "
207214 exit 1
208215 ;;
216+ -b)
217+ build_sage
218+ exit 0
219+ ;;
220+ -br|--br)
221+ build_sage
222+ shift ; set -- -r " $@ " # delegate to handling of "-r" below, after sourcing sage-env
223+ ;;
224+ -bn|--build-and-notebook)
225+ build_sage
226+ shift ; set -- -n " $@ " # delegate to handling of "-n" below, after sourcing sage-env
227+ ;;
228+ -ba)
229+ ( cd " $SAGE_ROOT " && make sagelib-clean )
230+ build_sage
231+ exit 0
232+ ;;
233+ -bt* )
234+ build_sage
235+ switch_without_b=-${1# -b}
236+ shift ; set -- $switch_without_b " $@ " # delegate to handling of "-t...." below, after sourcing sage-env
237+ ;;
209238esac
210239
211240# ####################################################################
@@ -264,7 +293,7 @@ sage_setup() {
264293 echo >&2 ' ************************************************************************'
265294 echo >&2 ' It seems that you are attempting to run Sage from an unpacked source'
266295 echo >&2 ' tarball, but you have not compiled it yet (or maybe the build has not'
267- echo >&2 ' finished). You should run `make` in the Sage root directory first.'
296+ echo >&2 ' finished). You should run `make` in the SAGE_ROOT directory first.'
268297 echo >&2 ' If you did not intend to build Sage from source, you should download'
269298 echo >&2 ' a binary tarball instead. Read README.txt for more information.'
270299 echo >&2 ' ************************************************************************'
842871# The notebook, grep, building Sage, testing Sage
843872# ####################################################################
844873
845- # build_sage, sage -b, sage -br, etc. could be moved to
846- # build/bin/sage-site. See #29111.
847-
848- build_sage () {
849- ( cd " $SAGE_ROOT /build/make" && ./install sagelib-no-deps ) || exit $?
850- }
851874
852875if [[ " $1 " =~ ^--notebook= .* || " $1 " =~ ^-n= .* || " $1 " =~ ^-notebook= .* ]] ; then
853876 sage-cleaner & > /dev/null &
@@ -882,47 +905,19 @@ if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then
882905 fi
883906fi
884907
885- if [ " $1 " = ' -b' ]; then
886- build_sage
887- exit $?
888- fi
889-
890- if [ " $1 " = ' -br' -o " $1 " = " --br" ]; then
891- build_sage
892- interactive_sage
893- fi
894-
895908if [ " $1 " = ' -r' ]; then
896909 shift
897910 interactive_sage
898911fi
899912
900- if [ " $1 " = ' -ba-force' -o " $1 " = ' --ba-force' ]; then
901- echo
902- echo " WARNING: 'sage --ba-force' is deprecated; use 'sage -ba' instead."
903- echo
904- ( cd " $SAGE_ROOT /build/make" && make sagelib-clean )
905- build_sage
906- exit $?
907- fi
908-
909- if [ " $1 " = ' -ba' ]; then
910- ( cd " $SAGE_ROOT /build/make" && make sagelib-clean )
911- build_sage
912- exit $?
913- fi
914-
915913exec-runtests () {
916914 sage_setup
917915 export PYTHONIOENCODING=" utf-8" # Fix encoding for doctests
918916 exec sage-runtests " $@ "
919917}
920918
921- if [ " $1 " = ' -t' -o " $1 " = ' -bt' -o " $1 " = ' -tp' -o " $1 " = ' -btp' ]; then
922- if [ " $1 " = ' -bt' -o " $1 " = ' -btp' ]; then
923- build_sage
924- fi
925- if [ " $1 " = ' -tp' -o " $1 " = ' -btp' ]; then
919+ if [ " $1 " = ' -t' -o " $1 " = ' -tp' ]; then
920+ if [ " $1 " = ' -tp' ]; then
926921 shift
927922 exec-runtests -p " $@ "
928923 else
@@ -931,10 +926,7 @@ if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" = '-tp' -o "$1" = '-btp' ]; then
931926 fi
932927fi
933928
934- if [ " $1 " = ' -tnew' -o " $1 " = ' -btnew' ]; then
935- if [ " $1 " = ' -btnew' ]; then
936- build_sage
937- fi
929+ if [ " $1 " = ' -tnew' ]; then
938930 shift
939931 exec-runtests --new " $@ "
940932fi
0 commit comments