Skip to content

Commit

Permalink
build/bin/sage-spkg-info: Use inline tabs for system package commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jan 14, 2024
1 parent aaa5b46 commit cfe1e6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build/bin/sage-print-system-package-command
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SUDO=
PROMPT=
SPKG=no
if [ -n "$OUTPUT_RST" ]; then
COMMENT=""
COMMENT="$RST_INDENT"
else
COMMENT="# "
fi
Expand Down Expand Up @@ -86,7 +86,7 @@ function print_shell_command()
{
if [ -n "$OUTPUT_RST" ]; then
echo
echo ".. CODE-BLOCK:: bash"
echo "$RST_INDENT.. CODE-BLOCK:: bash"
echo
fi
# shell-quote arguments if necessary
Expand Down
27 changes: 19 additions & 8 deletions build/bin/sage-spkg-info
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ if [ -n "$OUTPUT_RST" ]; then
echo ".. _spkg_$PKG_BASE:"
echo
ref () { echo ":ref:\`$1\`"; }
spkg () { ref spkg_$1; }
issue () { echo ":issue:\`$1\`"; }
code () { echo "\`\`$*\`\`"; }
tab () { echo ".. tab:: $1"; }
else
ref () { echo "$1"; }
spkg () { echo "$1"; }
issue () { echo "https://github.com/sagemath/sage/issues/$1"; }
code () { echo "$1"; }
tab () { echo "$1:"; }
fi
PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE"
for ext in rst txt; do
Expand Down Expand Up @@ -56,7 +60,7 @@ for dep_file in dependencies dependencies_order_only; do
# Looks like a package
*) if [ -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then
# This RST label is set in src/doc/bootstrap
echo "- $(ref spkg_$dep)"
echo "- $(spkg $dep)"
else
echo "- $dep"
fi;;
Expand Down Expand Up @@ -96,31 +100,38 @@ for system_package_file in "$PKG_DISTROS"/*.txt; do
esac
fi
done
if [ $have_repology = yes ]; then
systems="$systems repology"
fi
system=
# Show using inline tabs
export RST_INDENT=" "
for system in $systems; do
system_package_file="$PKG_DISTROS"/$system.txt
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
case $system in
debian)
# Generic
echo "Debian/Ubuntu:"
tab "Debian/Ubuntu"
;;
fedora)
# Generic
echo "Fedora/Redhat/CentOS:"
tab "Fedora/Redhat/CentOS"
;;
repology)
;;
*)
echo "$system:"
tab "$system"
;;
esac
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
sage-print-system-package-command $system --wrap --prompt="$RST_INDENT"' $ ' --continuation="$RST_INDENT"' ' --sudo install $system_packages
echo
done
unset RST_INDENT
if [ $have_repology = yes ]; then
# Show below the inline tabs
system=repology
system_package_file="$PKG_DISTROS"/$system.txt
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
fi
if [ -z "$system" ]; then
echo "(none known)"
else
Expand Down

0 comments on commit cfe1e6b

Please sign in to comment.