From 84c3e366a6b63abbf4c51f43b2e7cd5ce287eea8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Dec 2023 19:53:22 -0800 Subject: [PATCH] build/bin/sage-spkg-info: Fix and improve RST markup --- build/bin/sage-spkg-info | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index f39fdbdc6b2..6ca6fc0e394 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -7,8 +7,17 @@ PKG_BASE=$1 if [ -n "$OUTPUT_DIR" ]; then exec > "$OUTPUT_DIR"/$PKG_BASE.rst +fi +if [ -n "$OUTPUT_RST" ]; then echo ".. _spkg_$PKG_BASE:" echo + ref () { echo ":ref:\`$1\`"; } + issue () { echo ":issue:\`$1\`"; } + code () { echo "\`\`$*\`\`"; } +else + ref () { echo "$1"; } + issue () { echo "https://github.com/sagemath/sage/issues/$1"; } + code () { echo "$1"; } fi PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE" for ext in rst txt; do @@ -45,9 +54,9 @@ for dep_file in dependencies dependencies_order_only; do # Dependencies like $(BLAS) \$\(*) echo "- $dep";; # Looks like a package - *) if [ -n "$OUTPUT_RST" -a -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then + *) if [ -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then # This RST label is set in src/doc/bootstrap - echo "- :ref:\`spkg_$dep\`" + echo "- $(ref spkg_$dep)" else echo "- $dep" fi;; @@ -120,15 +129,15 @@ else if [ -f "${SPKG_CONFIGURE}" ]; then if grep -q SAGE_PYTHON_PACKAGE_CHECK "${SPKG_CONFIGURE}"; then echo "If the system package is installed and if the (experimental) option" - echo "--enable-system-site-packages is passed to ./configure, then ./configure" + echo "$(code --enable-system-site-packages) is passed to $(code ./configure), then $(code ./configure)" echo "will check if the system package can be used." else - echo "If the system package is installed, ./configure will check if it can be used." + echo "If the system package is installed, $(code ./configure) will check if it can be used." fi else echo "However, these system packages will not be used for building Sage" - echo "because spkg-configure.m4 has not been written for this package;" - echo "see https://github.com/sagemath/sage/issues/27330" + echo "because $(code spkg-configure.m4) has not been written for this package;" + echo "see $(issue 27330)" fi fi echo