Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,15 @@ fi
# build/bin/sage-site. See #29111; but OTOH #34627.

build_sage() {
( cd "$SAGE_ROOT" && make sagelib-no-deps ) || exit $?
# Check for the expected editable meson build directory
if [ -f "build/build.ninja" ]; then
echo "Building Sage with ninja..."
( cd "$SAGE_ROOT" && ninja -C build ) || exit $?
else
echo "Error: 'sage -b' is for editable meson-based developer builds." >&2
echo "Please use 'make' or 'meson' directly for other builds." >&2
exit 1
fi
}

# Check for '-i' etc. before sourcing sage-env: running "make"
Expand All @@ -212,8 +220,10 @@ case "$1" in
exit 0
;;
-br|--br)
echo "Warning: 'sage -br' is deprecated." >&2
echo "In an editable install, just run './sage' to use the latest built code." >&2
build_sage
shift; set -- -r "$@" # delegate to handling of "-r" below, after sourcing sage-env
shift; set -- -r "$@"
;;
-bn|--build-and-notebook)
build_sage
Expand Down
19 changes: 19 additions & 0 deletions src/doc/en/reference/repl/startup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,22 @@ in this file.

The default location of this file can be changed using the
environment variable :envvar:`SAGE_STARTUP_FILE`.

.. _sage_subcommands:

Sage Subcommands
----------------

The ``sage`` script can be used to invoke several subcommands, including:

* ``sage -b``: Rebuilds the Sage library. This is intended for developer-only
editable Meson builds. It runs ``ninja -C build`` to recompile. If a
non-Meson build is detected, it will error out with a message.

* ``sage -br``: **Deprecated.** This command is no longer supported and
will be removed in a future release. Use ``sage -b`` to build and
``./sage`` to run.

* ``sage --python``: Runs the Python interpreter included with Sage.

* ``sage -i <package>``: Installs a Sage package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that your patch actually removes sage -i, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I accidentally overwrote the case statement and wiped the other commands 😅

I've fixed it now

Loading