Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

57.2. python3-docutils-0.23

Set of tools for processing plaintext docs into formats such as HTML, XML, or LaTeX

Version 0.23, release 1
Shelf python-libs — General-purpose python3-* runtime libraries: text, templating, markup, parsing, config, CLI, system, files, crypto, imaging
Phase 30_foundation (Build Foundation), 52 of 127 in build order
Licence LicenseRef-Public-Domain AND BSD-2-Clause AND BSD-3-Clause
Homepage https://docutils.sourceforge.io/
Build time 0.1 SBU
Installed size 4.4 MiB in 359 files
Recipe ports/core/python-libs/python3-docutils/kpkgbuild

About

Docutils turns reStructuredText, the plain-text markup most Python documentation is written in, into HTML, LaTeX, XML, OpenDocument and manual pages. It installs the docutils command and the rst2* front ends, rst2man among them.

In KDOS it is chiefly a manual-page generator: ports that write their pages in reStructuredText run rst2man at build time, among them glib, gtk4 and mpv, and the tree lists it with the other generators that are ports in Manual pages. python3-sphinx is built on it. docutils highlights the contents of a code directive with python3-pygments, named in depends, when it can import it, and leaves them plain when it cannot.

Sources

Dependencies

Depends on: python3, python3-setuptools, python3-pip, python3-pygments.

Required by (22): alsa-utils, bluez, bpftool, cifs-utils, gdk-pixbuf, glib, glib-introspection, gtk4, json-glib, libdrm, librsvg, libvirt, mpv, pango, python3-kivy, python3-sphinx, sddm, spyder, sshfs, universal-ctags, virt-manager, xdg-desktop-portal.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install python3-docutils'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-libs/python3-docutils.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/python-libs/python3-docutils
echo '746f5060322511280a1e50eb76846ed6bf2342984b2ac04dc42caa1a8d78799e  python3-docutils-0.23.tar.gz' | sha256sum -c -
echo '7570d0c81de42023f35dabc64458abdfd94382db7517a5b46366002241da6db6  python3-docutils-vendor-0.23.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/python3-docutils
SRC=$SRC_ROOT/python3-docutils-0.23
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-docutils-0.23.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

mkdir -p vendor
tar -xf $PORT_SRC/$name-vendor-$version.tar.xz --strip-components=1 -C vendor
pip3 install . --ignore-installed --no-deps --find-links=vendor --no-index --root="$PKG" --prefix=/usr
for i in $PKG/usr/bin/*.py; do
	[ -e "$i" ] || continue
	i=${i##*/}
	ln -sf $i $PKG/usr/bin/${i%.*}
done

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/python3-docutils, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf python3-docutils-0.23-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/python3-docutils, and runs the triggers its paths call for.

Contents

Installed programs: docutils, rst2html, rst2html4, rst2html5, rst2latex, rst2man, rst2odt, rst2pseudoxml, rst2s5, rst2xetex, rst2xml.

Installed directories: /usr/lib/python3.14/site-packages/docutils, /usr/lib/python3.14/site-packages/docutils-0.23.dist-info, /usr/share/licenses/python3-docutils.

Notes

The for loop after the install links each /usr/bin/*.py script to its name without .py. docutils declares its commands as console scripts with no suffix (rst2man, rst2html5 and the rest), so the glob matches nothing and the loop links nothing; the [ -e "$i" ] || continue line is what keeps an unmatched glob from failing the build.