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

56.8. python3-setuptools-scm-10.3.4

Version from VCS — matplotlib requires it at build time

Version 10.3.4, release 1
Shelf python — The python3 interpreter, tkinter, and Python build, packaging and extension tooling
Phase 30_foundation (Build Foundation), 43 of 127 in build order
Licence MIT
Homepage https://pypi.org/project/setuptools_scm/
Build time 0.1 SBU
Installed size 176.3 KiB in 58 files
Recipe ports/core/python/python3-setuptools-scm/kpkgbuild

About

setuptools-scm is the setuptools plugin that sets a package’s version from version control, using python3-vcs-versioning for the work. A project that declares dynamic = ["version"] and lists setuptools-scm among its build requirements gets its version from the Git tags of a checkout or, in a source distribution, from the PKG-INFO file the distribution was made with.

Many ports in KDOS build with it. In 30_foundation it is a build requirement of python3-pluggy, and python3-hatch-vcs calls it on behalf of hatchling projects; later phases build matplotlib, astropy, khal, khard, deluge and many python3-* modules with it.

Sources

Dependencies

Depends on: python3, python3-setuptools, python3-pip, python3-packaging, python3-vcs-versioning.

Required by (52): astropy, calibre, chirp, cura, deluge, git-cola, gnuhealth, jupyterlab, khal, khard, matplotlib, python3-attrs, python3-automat, python3-cantools, python3-cattrs, python3-cppy, python3-dateutil, python3-extension-helpers, python3-flask-cors, python3-gmpy2, python3-hatch-vcs, python3-isodate, python3-jsonschema, python3-jsonschema-specifications, python3-keyring, python3-kiwisolver, python3-lark, python3-lsp-server, python3-meshtastic, python3-nbconvert, python3-nest-asyncio, python3-obd, python3-pathvalidate, python3-pluggy, python3-pyerfa, python3-pypdfium2, python3-pyqt-builder, python3-pyusb, python3-pyvisa, python3-pyvisa-py, python3-referencing, python3-setuptools-rust, python3-sip, python3-uharfbuzz, python3-urllib3, python3-urwid, python3-xlib, python3-ytmusicapi, spyder, toot, uranium, vdirsyncer.

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-setuptools-scm'

What kpkg does

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

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/python3-setuptools-scm
echo 'a69f28bfc245608781205e912faae437c2b2165773afa4e7b979d77447a69dd2  python3-setuptools-scm-10.3.4.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-setuptools-scm
SRC=$SRC_ROOT/python3-setuptools-scm-10.3.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-setuptools-scm-10.3.4.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:

pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr .

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-setuptools-scm, 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-setuptools-scm-10.3.4-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-setuptools-scm, and runs the triggers its paths call for.

Contents

Installed programs: setuptools-scm.

Installed directories: /usr/lib/python3.14/site-packages/setuptools_scm, /usr/lib/python3.14/site-packages/setuptools_scm-10.3.4.dist-info, /usr/share/licenses/python3-setuptools-scm.

Notes

A port’s source has no version-control metadata: kpkg unpacks a tarball. A PyPI source distribution carries PKG-INFO, which vcs-versioning’s pkginfo fallback reads, so such a port needs nothing more. A source taken from a forge’s tag archive has neither .git nor PKG-INFO, and the port gives the version itself through SETUPTOOLS_SCM_PRETEND_VERSION in its build.sh, as several ports in the tree do.