mirror of
https://src.fedoraproject.org/rpms/sagemath.git
synced 2025-04-10 23:18:51 -04:00
- Drop upstreamed -eclib patch. - Drop unnecessary -readonly patch. - Unbundle ipywidgets. - Bundle memory_allocator for now.
399 lines
14 KiB
Diff
399 lines
14 KiB
Diff
diff -up src/bin/sage.orig src/bin/sage
|
|
--- src/bin/sage.orig 2021-08-22 02:44:33.000000000 -0600
|
|
+++ src/bin/sage 2021-08-26 13:09:38.262699484 -0600
|
|
@@ -109,7 +109,6 @@ usage() {
|
|
echo " --gap [...] -- run Sage's Gap with given arguments"
|
|
echo " --gp [...] -- run Sage's PARI/GP calculator with given arguments"
|
|
echo " -h -- print this help message"
|
|
- echo " --pip [...] -- invoke pip, the Python package manager"
|
|
echo " --maxima [...] -- run Sage's Maxima with given arguments"
|
|
echo " --mwrank [...] -- run Sage's mwrank with given arguments"
|
|
echo " --notebook=[...] -- start the Sage notebook (valid options are"
|
|
@@ -160,111 +159,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' before sourcing sage-env: running "make"
|
|
-# should be run outside of the Sage shell.
|
|
-if [ "$1" = '-f' ]; then
|
|
- # -f is an alias for -i -f
|
|
- set -- -i "$@"
|
|
-fi
|
|
-
|
|
-if [ "$1" = '-i' ]; then
|
|
- shift
|
|
- if [ -z "$MAKE" ]; then
|
|
- MAKE="make"
|
|
- fi
|
|
-
|
|
- set -e
|
|
- cd "$SAGE_ROOT"
|
|
-
|
|
- # Parse options
|
|
- PACKAGES="" # Packages to install
|
|
- INSTALL_OPTIONS="" # Options to sage-spkg
|
|
- for OPT in "$@"; do
|
|
- case "$OPT" in
|
|
- -info|--info)
|
|
- echo >&2 "Error: 'sage -i $OPT <package>' is no longer supported, use 'sage --info <package>' instead."
|
|
- exit 2;;
|
|
- -f) FORCE_INSTALL=yes;;
|
|
- # Setting SAGE_CHECK here duplicates what we do in sage-spkg
|
|
- # but we need it in "make" already when there are (order-only)
|
|
- # dependencies on packages providing test infrastructure
|
|
- -c) INSTALL_OPTIONS="$INSTALL_OPTIONS $OPT"; export SAGE_CHECK=yes;;
|
|
- -w) INSTALL_OPTIONS="$INSTALL_OPTIONS $OPT"; export SAGE_CHECK=warn;;
|
|
- -*) INSTALL_OPTIONS="$INSTALL_OPTIONS $OPT";;
|
|
- *) PACKAGES="$PACKAGES $OPT";;
|
|
- esac
|
|
- done
|
|
-
|
|
- # First, uninstall the packages if -f was given
|
|
- if [ "$FORCE_INSTALL" = yes ]; then
|
|
- for PKG in $PACKAGES; do
|
|
- $MAKE "$PKG-clean" || true # Ignore errors
|
|
- done
|
|
- fi
|
|
-
|
|
- # Make sure that the toolchain is up-to-date
|
|
- # (which is a dependency of every package)
|
|
- $MAKE all-toolchain
|
|
-
|
|
- ALL_TARGETS="$($MAKE list 2>/dev/null)"
|
|
-
|
|
- # Now install the packages
|
|
- for PKG in $PACKAGES; do
|
|
- echo
|
|
- # Check that $PKG is actually a Makefile target
|
|
- # See https://trac.sagemath.org/ticket/25078
|
|
- if ! echo "$ALL_TARGETS" | grep "^${PKG}$" >/dev/null; then
|
|
- echo >&2 "Error: package '$PKG' not found"
|
|
- echo >&2 "Note: if it is an old-style package, installing these is no longer supported"
|
|
- exit 1
|
|
- fi
|
|
- $MAKE SAGE_SPKG="sage-spkg $INSTALL_OPTIONS" "$PKG"
|
|
- done
|
|
- echo "New packages may have been installed."
|
|
- echo "Re-running configure and make in case any dependent packages need updating."
|
|
- touch "$SAGE_ROOT/configure" && $MAKE all-build
|
|
- exit 0
|
|
-fi
|
|
-
|
|
-#####################################################################
|
|
# Report information about the Sage environment
|
|
#####################################################################
|
|
|
|
@@ -309,20 +203,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
|
|
-
|
|
- maybe_sage_location
|
|
-
|
|
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
|
|
@@ -333,20 +213,6 @@ sage_setup() {
|
|
}
|
|
|
|
|
|
-# Check to see if the whole Sage install tree has moved. If so,
|
|
-# change various hardcoded paths. Skip this if we don't have write
|
|
-# access to $SAGE_LOCAL (e.g. when running as a different user) or
|
|
-# if Python and sage-location haven't been installed yet.
|
|
-maybe_sage_location()
|
|
-{
|
|
- if [ -n "$SAGE_LOCAL" -a -w "$SAGE_LOCAL" ]; then
|
|
- if [ -x "$SAGE_VENV/bin/python" ] && [ -x "$SAGE_VENV/bin/sage-location" ]; then
|
|
- sage-location || exit $?
|
|
- fi
|
|
- fi
|
|
-}
|
|
-
|
|
-
|
|
# Start an interactive Sage session, this function never returns.
|
|
interactive_sage() {
|
|
sage_setup
|
|
@@ -384,8 +250,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"
|
|
if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then
|
|
@@ -419,18 +283,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"
|
|
@@ -677,11 +532,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)
|
|
@@ -706,11 +556,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
|
|
#####################################################################
|
|
@@ -877,11 +722,6 @@ fi
|
|
# build_sage, sage -b, sage -br, etc. could be moved to
|
|
# build/bin/sage-site. See #29111.
|
|
|
|
-build_sage() {
|
|
- maybe_sage_location
|
|
- ( 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 "$@"
|
|
@@ -892,13 +732,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.
|
|
@@ -915,46 +748,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 "$@"
|
|
@@ -964,34 +769,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
|
|
@@ -1014,59 +796,11 @@ fi
|
|
# Creating and handling Sage distributions
|
|
#####################################################################
|
|
|
|
-# The following could be moved to build/bin/sage-site. See #29111.
|
|
-
|
|
-if [ "$1" = '--location' ]; then
|
|
- maybe_sage_location
|
|
- exit 0
|
|
-fi
|
|
-
|
|
-
|
|
-install() {
|
|
- maybe_sage_location
|
|
-
|
|
- for PKG in "$@"
|
|
- do
|
|
- # Check for options
|
|
- case "$PKG" in
|
|
- -*)
|
|
- INSTALL_OPTIONS="$INSTALL_OPTIONS $PKG"
|
|
- continue;;
|
|
- esac
|
|
-
|
|
- PKG_NAME=`echo "$PKG" | sed -e "s/\.spkg$//"`
|
|
- PKG_NAME=`basename "$PKG_NAME"`
|
|
-
|
|
- sage-logger \
|
|
- "sage-spkg $INSTALL_OPTIONS '$PKG'" "$SAGE_LOGS/$PKG_NAME.log"
|
|
- # Do not try to install further packages if one failed
|
|
- if [ $? -ne 0 ]; then
|
|
- exit 1
|
|
- fi
|
|
- done
|
|
- exit 0
|
|
-}
|
|
-
|
|
if [ "$1" = '-installed' -o "$1" = "--installed" ]; then
|
|
shift
|
|
exec sage-list-packages all --installed-only $@
|
|
fi
|
|
|
|
-if [ "$1" = '-p' ]; then
|
|
- shift
|
|
- # If there are no further arguments, display usage help.
|
|
- if [ $# -eq 0 ]; then
|
|
- exec sage-spkg
|
|
- fi
|
|
- install "$@"
|
|
-fi
|
|
-
|
|
-if [ "$1" = '-sdist' -o "$1" = "--sdist" ]; then
|
|
- maybe_sage_location
|
|
- shift
|
|
- exec sage-sdist "$@"
|
|
-fi
|
|
-
|
|
#####################################################################
|
|
# Debugging tools
|
|
#####################################################################
|
|
@@ -1110,12 +844,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 "$@"
|