Skip to content

Commit bfe545c

Browse files
committed
Issue #41161: Update sage -b to use ninja and deprecate sage -br
1 parent aa27703 commit bfe545c

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

src/bin/sage

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -191,43 +191,29 @@ fi
191191
# build/bin/sage-site. See #29111; but OTOH #34627.
192192

193193
build_sage() {
194-
( cd "$SAGE_ROOT" && make sagelib-no-deps ) || exit $?
194+
# Checking for the editable meson-build directory
195+
if [ -f "build/build.ninja" ]; then
196+
echo "Building Sage with ninja..."
197+
( cd "$SAGE_ROOT" && ninja -C build ) || exit $?
198+
else
199+
#Handling non-editable installs or other non-standard setups here.
200+
echo "Error: 'sage -b' is for editable meson-based developer builds." >&2
201+
echo "Please use 'make' or 'meson' directly for other builds." >&2
202+
exit 1
203+
fi
195204
}
196205

197-
# Check for '-i' etc. before sourcing sage-env: running "make"
198-
# should be run outside of the Sage shell.
199206
case "$1" in
200-
-i|-f|-p)
201-
# Delegate further option handling to the non-installed sage-site script.
202-
# (These options become unavailable if the directory $SAGE_ROOT is removed.)
203-
if [ -d "$SAGE_ROOT" ]; then
204-
exec "$SAGE_ROOT/build/bin/sage-site" "$@"
205-
# fallthrough if there is no sage-site script
206-
fi
207-
echo >&2 "Error: unknown option: $1"
208-
exit 1
209-
;;
207+
210208
-b)
211209
build_sage
212210
exit 0
213211
;;
214212
-br|--br)
213+
echo "Warning: 'sage -br' is deprecated." >&2
214+
echo "In an editable install, just run './sage' to use the latest built code." >&2
215215
build_sage
216-
shift; set -- -r "$@" # delegate to handling of "-r" below, after sourcing sage-env
217-
;;
218-
-bn|--build-and-notebook)
219-
build_sage
220-
shift; set -- -n "$@" # delegate to handling of "-n" below, after sourcing sage-env
221-
;;
222-
-ba)
223-
( cd "$SAGE_ROOT" && make sagelib-clean )
224-
build_sage
225-
exit 0
226-
;;
227-
-bt*)
228-
build_sage
229-
switch_without_b=-${1#-b}
230-
shift; set -- $switch_without_b "$@" # delegate to handling of "-t...." below, after sourcing sage-env
216+
shift; set -- -r "$@"
231217
;;
232218
esac
233219

src/doc/en/reference/repl/startup.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,22 @@ in this file.
4242

4343
The default location of this file can be changed using the
4444
environment variable :envvar:`SAGE_STARTUP_FILE`.
45+
46+
.. _sage_subcommands:
47+
48+
Sage Subcommands
49+
----------------
50+
51+
The ``sage`` script can be used to invoke several subcommands, including:
52+
53+
* ``sage -b``: Rebuilds the Sage library. This is intended for developer-only
54+
editable Meson builds. It runs ``ninja -C build`` to recompile. If a
55+
non-Meson build is detected, it will error out with a message.
56+
57+
* ``sage -br``: **Deprecated.** This command is no longer supported and
58+
will be removed in a future release. Use ``sage -b`` to build and
59+
``./sage`` to run.
60+
61+
* ``sage --python``: Runs the Python interpreter included with Sage.
62+
63+
* ``sage -i <package>``: Installs a Sage package.

0 commit comments

Comments
 (0)