From 6914f61d486bd51b95971feee9dcb4ba3213dc7f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 14 Jan 2024 13:35:37 -0800 Subject: [PATCH] build/bin/sage-spkg-info: Use inline tabs for system package commands --- build/bin/sage-print-system-package-command | 4 +-- build/bin/sage-spkg-info | 27 +++++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build/bin/sage-print-system-package-command b/build/bin/sage-print-system-package-command index 722a7f75161..dc9935f50f5 100755 --- a/build/bin/sage-print-system-package-command +++ b/build/bin/sage-print-system-package-command @@ -7,7 +7,7 @@ SUDO= PROMPT= SPKG=no if [ -n "$OUTPUT_RST" ]; then - COMMENT="" + COMMENT="$RST_INDENT" else COMMENT="# " fi @@ -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 diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 6b66e584331..4d7afcecd35 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -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 @@ -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;; @@ -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