Skip to content

Commit 8b2ac7c

Browse files
author
Matthias Koeppe
committed
src/doc/bootstrap: Parallelize generation of SPKG.rst files
1 parent e2e0f8d commit 8b2ac7c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

build/bin/sage-spkg-info

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
#
66
# Assumes SAGE_ROOT is set
77
PKG_BASE=$1
8+
if [ -n "$OUTPUT_DIR" ]; then
9+
exec > "$OUTPUT_DIR"/$PKG_BASE.rst
10+
echo ".. _spkg_$PKG_BASE:"
11+
fi
812
PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE"
913
for ext in rst txt; do
1014
SPKG_FILE="$PKG_SCRIPTS/SPKG.$ext"
1115
if [ -f "$SPKG_FILE" ]; then
12-
sed "1,3s/^ *Sage: Open Source Mathematics Software:/$PKG_BASE:/" "$SPKG_FILE"
16+
# for sphinx 4.4 we need to replace all direct links by some "extlink" (issue 33272)
17+
sed -e "1,3s/^ *Sage: Open Source Mathematics Software:/$PKG_BASE:/" -e "s|https://github.com/sagemath/sage/issues/\([0-9]*\)|:issue:\`\1\`|g" -e "s|https://arxiv.org/abs/cs/\([0-9]*\)|:arxiv:\`cs/\1\`|g" "$SPKG_FILE"
1318
break
1419
fi
1520
done

src/doc/bootstrap

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ All External Packages
190190
EOF
191191

192192
OUTPUT_INDEX="$OUTPUT_DIR"/index_alph.rst
193-
cat >> "$OUTPUT_INDEX" <<EOF
193+
(cat <<EOF
194194
195195
Details of external packages
196196
============================
@@ -204,16 +204,12 @@ Packages are in alphabetical order.
204204
205205
EOF
206206
for PKG_BASE in $(sage-package list --has-file SPKG.rst); do
207-
PKG_SCRIPTS=build/pkgs/$PKG_BASE
208-
# Instead of just copying, we may want to call
209-
# a version of sage-spkg-info to format extra information.
210-
# for sphinx 4.4 we need to replace all direct links by some "extlink" (issue 33272)
211-
212-
(echo ".. _spkg_$PKG_BASE:" && echo && OUTPUT_RST=1 sage-spkg-info $PKG_BASE) | sed -e "s|https://github.com/sagemath/sage/issues/\([0-9]*\)|:issue:\`\1\`|g" -e "s|https://arxiv.org/abs/cs/\([0-9]*\)|:arxiv:\`cs/\1\`|g" > "$OUTPUT_DIR"/$PKG_BASE.rst
213-
echo >> "$OUTPUT_INDEX" " $PKG_BASE"
207+
echo " $PKG_BASE"
214208
done
215-
cat >> "$OUTPUT_INDEX" <<EOF
209+
cat <<EOF
216210
217211
.. default-role::
218212
219213
EOF
214+
) > "$OUTPUT_INDEX"
215+
sage-package list --has-file SPKG.rst | OUTPUT_DIR=$OUTPUT_DIR OUTPUT_RST=1 xargs -P 0 -n 1 sage-spkg-info

0 commit comments

Comments
 (0)