Description: work around unset SAGE_ROOT in Debian Sage package
In this shell script, '$1' refers to the Sage binary that is to
be used. The script is needlessly complex to accommodate for old
versions of Sage, and perhaps the author is unaware of Sage's
new commandline arguments.
.
Debian's `sage root` is an empty string, so Cantor fails to
start it. This patch is more succinct by starting the Sage shell
which sets all variables appropriately, then starting
'sageipython' as desired. This way, as opposed to having
'#!/usr/bin/sage sh' as the shebang, still permits usage of
local Sage copies.
Author: John Scott
BugDebian: https://bugs.debian.org/972346
Forwarded: https://bugs.kde.org/show_bug.cgi?id=408176#c19
LastUpdate: 20210117
 cantor20.12.1.orig/src/backends/sage/cantorexecsage
+++ cantor20.12.1/src/backends/sage/cantorexecsage
@@ 1,23 +1,2 @@
#!/usr/bin/env bash

export SAGE_ROOT="$($1 root)"

# Sage 9.2 stop source sageenvconfig automatically, so do it manually
if [[ f $SAGE_ROOT"/bin/sageenv" ]]; then
 if [[ f $SAGE_ROOT"/bin/sageenvconfig" ]]; then
 source "$SAGE_ROOT/bin/sageenvconfig" >&2
 fi
 . "$SAGE_ROOT/bin/sageenv" >&2
elif [[ f $SAGE_ROOT"/local/bin/sageenv" ]]; then
 if [[ f $SAGE_ROOT"/local/bin/sageenvconfig" ]]; then
 source "$SAGE_ROOT/local/bin/sageenvconfig" >&2
 fi
 . "$SAGE_ROOT/local/bin/sageenv" >&2
elif [[ f $SAGE_ROOT"/src/bin/sageenv" ]]; then
 if [[ f $SAGE_ROOT"/src/bin/sageenvconfig" ]]; then
 source "$SAGE_ROOT/src/bin/sageenvconfig" >&2
 fi
 . "$SAGE_ROOT/src/bin/sageenv" >&2
fi

exec sageipython i simpleprompt
+{ echo "sageipython i simpleprompt"; cat; }  $1 sh