@@ -193,6 +193,13 @@ if [ "$1" = '--nodotsage' ]; then
193
193
exit $status
194
194
fi
195
195
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
+
196
203
# Check for '-i' etc. before sourcing sage-env: running "make"
197
204
# should be run outside of the Sage shell.
198
205
case " $1 " in
@@ -206,6 +213,28 @@ case "$1" in
206
213
echo >&2 " Error: unknown option: $1 "
207
214
exit 1
208
215
;;
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
+ ;;
209
238
esac
210
239
211
240
# ####################################################################
@@ -264,7 +293,7 @@ sage_setup() {
264
293
echo >&2 ' ************************************************************************'
265
294
echo >&2 ' It seems that you are attempting to run Sage from an unpacked source'
266
295
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.'
268
297
echo >&2 ' If you did not intend to build Sage from source, you should download'
269
298
echo >&2 ' a binary tarball instead. Read README.txt for more information.'
270
299
echo >&2 ' ************************************************************************'
842
871
# The notebook, grep, building Sage, testing Sage
843
872
# ####################################################################
844
873
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
- }
851
874
852
875
if [[ " $1 " =~ ^--notebook= .* || " $1 " =~ ^-n= .* || " $1 " =~ ^-notebook= .* ]] ; then
853
876
sage-cleaner & > /dev/null &
@@ -882,47 +905,19 @@ if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then
882
905
fi
883
906
fi
884
907
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
-
895
908
if [ " $1 " = ' -r' ]; then
896
909
shift
897
910
interactive_sage
898
911
fi
899
912
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
-
915
913
exec-runtests () {
916
914
sage_setup
917
915
export PYTHONIOENCODING=" utf-8" # Fix encoding for doctests
918
916
exec sage-runtests " $@ "
919
917
}
920
918
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
926
921
shift
927
922
exec-runtests -p " $@ "
928
923
else
@@ -931,10 +926,7 @@ if [ "$1" = '-t' -o "$1" = '-bt' -o "$1" = '-tp' -o "$1" = '-btp' ]; then
931
926
fi
932
927
fi
933
928
934
- if [ " $1 " = ' -tnew' -o " $1 " = ' -btnew' ]; then
935
- if [ " $1 " = ' -btnew' ]; then
936
- build_sage
937
- fi
929
+ if [ " $1 " = ' -tnew' ]; then
938
930
shift
939
931
exec-runtests --new " $@ "
940
932
fi
0 commit comments