56.2. python3-setuptools-84.0.0
Library for building, packaging and installing Python projects
| Version | 84.0.0, release 1 |
| Shelf | python — The python3 interpreter, tkinter, and Python build, packaging and extension tooling |
| Phase | 30_foundation (Build Foundation), 37 of 127 in build order |
| Licence | MIT AND Apache-2.0 AND LGPL-3.0-only |
| Homepage | https://setuptools.pypa.io/ |
| Build time | 0.1 SBU |
| Installed size | 10.7 MiB in 1008 files |
| Recipe | ports/core/python/python3-setuptools/kpkgbuild |
About
setuptools is a build backend for Python packages: the setup.py and setuptools.build_meta machinery that turns a source tree into a wheel, and builds C extensions on the way. It also provides a distutils module, which Python’s own standard library does not include, for programs that import one: setuptools/_distutils, which the _distutils_hack shim puts in its place. It does not provide pkg_resources; a program that imports it fails at run time. Many python3-* ports in the tree build with it, and so does meson, which 30_foundation installs with pip once this port and python3-pip are in place.
It is built before pip exists, and it needs nothing but the interpreter to build itself: the libraries it uses (packaging, wheel, platformdirs, tomli, jaraco’s and the rest) are vendored inside it under setuptools/_vendor. So build.sh does not use pip. It calls setuptools’ own PEP 517 hook, build_meta.build_wheel, from the source directory, unpacks the resulting wheel into the interpreter’s purelib directory inside $PKG with the standard library’s zipfile module, and compiles the bytecode itself. python3-pip depends on this port, and every later Python port that installs with pip comes after both.
Sources
python3-setuptools-84.0.0.tar.gz(1.1 MiB)
sha256f4695c21257f0d9b537ec2692c941d02ee143b7cc1276941349a546573b2ef73
upstream: https://files.pythonhosted.org/packages/source/s/setuptools/setuptools-84.0.0.tar.gz
archive copy: sources-3/python--python3-setuptools-84.0.0.tar.gz
Dependencies
Depends on: python3.
Required by (176): asciidoc, astropy, bcnc, brltty, brotli, calibre, chirp, cura, deluge, fonttools, gdal, git-cola, gnuhealth, gobject-introspection, gramps, ipython, jupyterlab, khal, khard, kolibri, libgusb, liblouis, libtorrent-rasterbar, lirc, matplotlib, meson, nmap, nomadnet, notmuch, numpy, onnxruntime, pandas, picard, printrun, python3-adafruit-nrfutil, python3-asgiref, python3-automat, python3-bcrypt, python3-calver, python3-cantools, python3-certifi, python3-cffi, python3-charset-normalizer, python3-click-log, python3-configobj, python3-constantly, python3-cppy, python3-cryptography, python3-cups, python3-cycler, python3-cython, python3-dasbus, python3-dateutil, python3-debugpy, python3-decorator, python3-defusedxml, python3-distro, python3-docutils, python3-ecdsa, python3-esptool, python3-extension-helpers, python3-flask-cors, python3-glad2, python3-gmpy2, python3-h5py, python3-html5lib, python3-httplib2, python3-hyperlink, python3-isodate, python3-jinja2, python3-jplephem, python3-keyring, python3-kivy, python3-kiwisolver, python3-lark, python3-libvirt, python3-lsp-ruff, python3-lsp-server, python3-lxmf, python3-lxml, python3-mako, python3-markdown, python3-markupsafe, python3-maturin, python3-meshtastic, python3-meson-python, python3-mpmath, python3-nbconvert, python3-nest-asyncio, python3-networkx, python3-obd, python3-opengl, python3-openpyxl, python3-owslib, python3-pathvalidate, python3-pefile, python3-pillow, python3-pillow-heif, python3-pip, python3-platformdirs, python3-pluggy, python3-ply, python3-protobuf, python3-psutil, python3-psycopg2, python3-pyarcus, python3-pycparser, python3-pyemf3, python3-pyerfa, python3-pygccxml, python3-pygments, python3-pyicu, python3-pynest2d, python3-pypdfium2, python3-pyqt-builder, python3-pyqt5-sip, python3-pyqt6-sip, python3-pyqtgraph, python3-pysavitar, python3-pyserial, python3-pyside6, python3-pysocks, python3-pytz, python3-pyusb, python3-pyvisa, python3-pyvisa-py, python3-pyxdg, python3-qtpy, python3-requests, python3-rns, python3-ruamel-yaml, python3-scour, python3-semantic-version, python3-send2trash, python3-setuptools-rust, python3-setuptools-scm, python3-sgp4, python3-shapely, python3-sip, python3-six, python3-sphinx, python3-tornado, python3-trove-classifiers, python3-uharfbuzz, python3-urwid, python3-vcs-versioning, python3-versioneer, python3-waitress, python3-wcwidth, python3-wheel, python3-wxpython, python3-xlib, python3-yapps, python3-ytmusicapi, python3-zope-interface, python3-zstandard, qutebrowser, radicale, scipy, scons, sideband, skyfield, spyder, sympy, system-config-printer, thrift, toot, tryton, uhd, uranium, urh, vdirsyncer, veusz, visidata, zenmap, zim.
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'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python/python3-setuptools.
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
echo 'f4695c21257f0d9b537ec2692c941d02ee143b7cc1276941349a546573b2ef73 python3-setuptools-84.0.0.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
SRC=$SRC_ROOT/python3-setuptools-84.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-setuptools-84.0.0.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:
python3 -c 'from setuptools import build_meta; build_meta.build_wheel("dist")'
_site=$(python3 -c 'import sysconfig; print(sysconfig.get_path("purelib"))')
python3 -m zipfile -e dist/setuptools-$version-*.whl "$PKG$_site"
python3 -m compileall -q -o 0 -o 1 -o 2 -d "$_site" "$PKG$_site"
find "$PKG" -path '*/setuptools/*.exe' -delete
The switches, and why each is set:
-o 0— with-o 1and-o 2,compileallwrites bytecode for all three optimisation levels: the plain.pycand the.opt-1.pycand.opt-2.pycthatpython3 -Oand-OOload. A wheel carries no bytecode, and an installer such as pip would normally compile it; here nothing else does, and a package without the.pycfiles would have Python try to write them into/usr/libat run time, where an ordinary user cannot.-d— the directory recorded in each.pycas its source’s location: the installed path under/usr, not the$PKGstaging path the files are compiled in. Tracebacks then name the real file.
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, 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-84.0.0-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, and runs the triggers its paths call for.
Contents
Installed directories: /usr/lib/python3.14/site-packages/_distutils_hack, /usr/lib/python3.14/site-packages/setuptools, /usr/lib/python3.14/site-packages/setuptools-84.0.0.dist-info, /usr/share/licenses/python3-setuptools.
Notes
The source carries Windows launcher executables, cli*.exe and gui*.exe, which setuptools copies next to console scripts it installs on Windows. build.sh deletes them from the package; nothing on Linux runs them.