Skip to content

Commit 2fe88d0

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

File tree

3 files changed

+43
-21
lines changed

3 files changed

+43
-21
lines changed

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

+5-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
@@ -103,6 +103,9 @@ function print_shell_command()
103103

104104
function print_comment()
105105
{
106+
if [ -n "$OUTPUT_RST" ]; then
107+
echo
108+
fi
106109
echo "${COMMENT}$1"
107110
}
108111

build/bin/sage-spkg-info

+38-18
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,47 @@ 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
107-
debian)
108-
# Generic
109-
echo "Debian/Ubuntu:"
110-
;;
111-
fedora)
112-
# Generic
113-
echo "Fedora/Redhat/CentOS:"
114-
;;
115-
repology)
116-
;;
117-
*)
118-
echo "$system:"
119-
;;
110+
alpine) tab "Alpine";;
111+
arch) tab "Arch Linux";;
112+
conda) tab "conda-forge";;
113+
cygwin) tab "Cygwin";;
114+
debian) tab "Debian/Ubuntu";;
115+
fedora) tab "Fedora/Redhat/CentOS";;
116+
freebsd) tab "FreeBSD";;
117+
gentoo) tab "Gentoo Linux";;
118+
homebrew) tab "Homebrew";;
119+
macports) tab "MacPorts";;
120+
nix) tab "Nixpkgs";;
121+
openbsd) tab "OpenBSD";;
122+
opensuse) tab "openSUSE";;
123+
slackware) tab "Slackware";;
124+
void) tab "Void Linux";;
125+
repology) ;;
126+
*) tab "$system";;
120127
esac
121-
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
128+
if [ -n "$system_packages" ]; then
129+
sage-print-system-package-command $system --wrap --prompt="$RST_INDENT"' $ ' --continuation="$RST_INDENT"' ' --sudo install $system_packages
130+
else
131+
echo
132+
echo "${RST_INDENT}No package needed."
133+
fi
122134
echo
123135
done
136+
unset RST_INDENT
137+
if [ $have_repology = yes ]; then
138+
# Show below the inline tabs
139+
system=repology
140+
system_package_file="$PKG_DISTROS"/$system.txt
141+
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
142+
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
143+
fi
124144
if [ -z "$system" ]; then
125145
echo "(none known)"
126146
else

build/pkgs/calver/distros/package-version.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)