57.3. python3-markupsafe-3.0.3
Markup-safe string type for XML, HTML and XHTML in Python
| Version | 3.0.3, release 2 |
| Shelf | python-libs — General-purpose python3-* runtime libraries: text, templating, markup, parsing, config, CLI, system, files, crypto, imaging |
| Phase | 30_foundation (Build Foundation), 53 of 127 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://markupsafe.palletsprojects.com/ |
| Build time | 0.1 SBU |
| Installed size | 72.7 KiB in 16 files |
| Recipe | ports/core/python-libs/python3-markupsafe/kpkgbuild |
About
MarkupSafe provides Markup, a string type that marks text as safe for HTML and XML, and the escape function that turns any other string into one. Template engines use it to escape whatever a template inserts unless it is already marked safe.
In KDOS it is the escaping layer of python3-jinja2 and python3-mako, and of python3-werkzeug and python3-flask. The fast path of its escaping is a C extension, markupsafe._speedups, which this port requires.
Sources
python3-markupsafe-3.0.3.tar.gz(78.4 KiB)
sha256722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698
upstream: https://files.pythonhosted.org/packages/source/m/markupsafe/markupsafe-3.0.3.tar.gz
archive copy: sources-4/python-libs--python3-markupsafe-3.0.3.tar.gz
Dependencies
Depends on: python3-setuptools, python3-pip.
Required by (10): gnuhealth, jupyterlab, python3-flask, python3-jinja2, python3-mako, python3-nbconvert, python3-sphinx, python3-werkzeug, qutebrowser, spyder.
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-markupsafe'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-libs/python3-markupsafe.
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-markupsafe
echo '722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698 python3-markupsafe-3.0.3.tar.gz' | 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-markupsafe
SRC=$SRC_ROOT/python3-markupsafe-3.0.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-markupsafe-3.0.3.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:
CIBUILDWHEEL=1 pip3 install --ignore-installed --no-build-isolation --no-deps --no-index --root=$PKG --prefix=/usr .
The switches, and why each is set:
CIBUILDWHEEL=1— Make the C extension mandatory. MarkupSafe’ssetup.pyotherwise catches a failed compile, prints a warning and builds a pure-Python package instead, which installs and imports without complaint; with the variable set, the failure stops the build. See Python modules.--no-build-isolation— Build with the setuptools already installed in the build root (requires = ["setuptools>=77"]) rather than one pip would fetch into a temporary environment; python3-setuptools is independs.
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-markupsafe, 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-markupsafe-3.0.3-2.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-markupsafe, and runs the triggers its paths call for.
Contents
Installed directories: /usr/lib/python3.14/site-packages/markupsafe, /usr/lib/python3.14/site-packages/markupsafe-3.0.3.dist-info, /usr/share/licenses/python3-markupsafe.