From 2fe88d009007f6cecea440a5713d6d627d9fe884 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 | 7 ++- build/bin/sage-spkg-info | 56 +++++++++++++------ build/pkgs/calver/distros/package-version.txt | 1 - 3 files changed, 43 insertions(+), 21 deletions(-) delete mode 100644 build/pkgs/calver/distros/package-version.txt diff --git a/build/bin/sage-print-system-package-command b/build/bin/sage-print-system-package-command index 722a7f75161..daf61c48c09 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 @@ -103,6 +103,9 @@ function print_shell_command() function print_comment() { + if [ -n "$OUTPUT_RST" ]; then + echo + fi echo "${COMMENT}$1" } diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 6b66e584331..b7b91a63339 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,47 @@ 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:" - ;; - fedora) - # Generic - echo "Fedora/Redhat/CentOS:" - ;; - repology) - ;; - *) - echo "$system:" - ;; + alpine) tab "Alpine";; + arch) tab "Arch Linux";; + conda) tab "conda-forge";; + cygwin) tab "Cygwin";; + debian) tab "Debian/Ubuntu";; + fedora) tab "Fedora/Redhat/CentOS";; + freebsd) tab "FreeBSD";; + gentoo) tab "Gentoo Linux";; + homebrew) tab "Homebrew";; + macports) tab "MacPorts";; + nix) tab "Nixpkgs";; + openbsd) tab "OpenBSD";; + opensuse) tab "openSUSE";; + slackware) tab "Slackware";; + void) tab "Void Linux";; + repology) ;; + *) tab "$system";; esac - sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages + if [ -n "$system_packages" ]; then + sage-print-system-package-command $system --wrap --prompt="$RST_INDENT"' $ ' --continuation="$RST_INDENT"' ' --sudo install $system_packages + else + echo + echo "${RST_INDENT}No package needed." + fi 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 diff --git a/build/pkgs/calver/distros/package-version.txt b/build/pkgs/calver/distros/package-version.txt deleted file mode 100644 index 42376d1100a..00000000000 --- a/build/pkgs/calver/distros/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -2022.6.26