Skip to content

Commit cfe1e6b

Browse files
author
Matthias Koeppe
committed
build/bin/sage-spkg-info: Use inline tabs for system package commands
1 parent aaa5b46 commit cfe1e6b

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

build/bin/sage-print-system-package-command

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SUDO=
77
PROMPT=
88
SPKG=no
99
if [ -n "$OUTPUT_RST" ]; then
10-
COMMENT=""
10+
COMMENT="$RST_INDENT"
1111
else
1212
COMMENT="# "
1313
fi
@@ -86,7 +86,7 @@ function print_shell_command()
8686
{
8787
if [ -n "$OUTPUT_RST" ]; then
8888
echo
89-
echo ".. CODE-BLOCK:: bash"
89+
echo "$RST_INDENT.. CODE-BLOCK:: bash"
9090
echo
9191
fi
9292
# shell-quote arguments if necessary

build/bin/sage-spkg-info

+19-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ if [ -n "$OUTPUT_RST" ]; then
1212
echo ".. _spkg_$PKG_BASE:"
1313
echo
1414
ref () { echo ":ref:\`$1\`"; }
15+
spkg () { ref spkg_$1; }
1516
issue () { echo ":issue:\`$1\`"; }
1617
code () { echo "\`\`$*\`\`"; }
18+
tab () { echo ".. tab:: $1"; }
1719
else
1820
ref () { echo "$1"; }
21+
spkg () { echo "$1"; }
1922
issue () { echo "https://github.com/sagemath/sage/issues/$1"; }
2023
code () { echo "$1"; }
24+
tab () { echo "$1:"; }
2125
fi
2226
PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE"
2327
for ext in rst txt; do
@@ -56,7 +60,7 @@ for dep_file in dependencies dependencies_order_only; do
5660
# Looks like a package
5761
*) if [ -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then
5862
# This RST label is set in src/doc/bootstrap
59-
echo "- $(ref spkg_$dep)"
63+
echo "- $(spkg $dep)"
6064
else
6165
echo "- $dep"
6266
fi;;
@@ -96,31 +100,38 @@ for system_package_file in "$PKG_DISTROS"/*.txt; do
96100
esac
97101
fi
98102
done
99-
if [ $have_repology = yes ]; then
100-
systems="$systems repology"
101-
fi
102103
system=
104+
# Show using inline tabs
105+
export RST_INDENT=" "
103106
for system in $systems; do
104107
system_package_file="$PKG_DISTROS"/$system.txt
105108
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
106109
case $system in
107110
debian)
108111
# Generic
109-
echo "Debian/Ubuntu:"
112+
tab "Debian/Ubuntu"
110113
;;
111114
fedora)
112115
# Generic
113-
echo "Fedora/Redhat/CentOS:"
116+
tab "Fedora/Redhat/CentOS"
114117
;;
115118
repology)
116119
;;
117120
*)
118-
echo "$system:"
121+
tab "$system"
119122
;;
120123
esac
121-
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
124+
sage-print-system-package-command $system --wrap --prompt="$RST_INDENT"' $ ' --continuation="$RST_INDENT"' ' --sudo install $system_packages
122125
echo
123126
done
127+
unset RST_INDENT
128+
if [ $have_repology = yes ]; then
129+
# Show below the inline tabs
130+
system=repology
131+
system_package_file="$PKG_DISTROS"/$system.txt
132+
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
133+
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
134+
fi
124135
if [ -z "$system" ]; then
125136
echo "(none known)"
126137
else

0 commit comments

Comments
 (0)