224.3. python3-gobject-3.58.0
GObject introspection bindings: GLib, GTK and every introspected library, from Python
| Version | 3.58.0, release 1 |
| Shelf | python-gui — python3-* GUI toolkit, desktop and D-Bus bindings |
| Phase | 42_graphics (Graphics Stack), 129 of 189 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://pygobject.gnome.org/ |
| Build time | 0.5 SBU |
| Installed size | 1.2 MiB in 59 files |
| Recipe | ports/core/python-gui/python3-gobject/kpkgbuild |
About
PyGObject is the Python binding for GObject-based libraries. It contains no per-library code: the gi module reads the typelibs that gobject-introspection generates and builds Python classes from them at import, so GLib, GTK, GStreamer and every other introspected library are reachable from Python through gi.repository. Python applications on GTK, and the Python tools that talk D-Bus through GLib, depend on it.
Sources
python3-gobject-3.58.0.tar.gz(1.3 MiB)
sha25645068697de3ffe46840ca369705f23118b34db4f7deb63f6eff079a6734ddcca
upstream: https://files.pythonhosted.org/packages/source/p/pygobject/pygobject-3.58.0.tar.gz
archive copy: sources-4/python-gui--python3-gobject-3.58.0.tar.gz
Dependencies
Depends on: python3, meson, ninja, pkgconf, glib, glib-introspection, gobject-introspection, libffi, cairo, python3-cairo.
Required by (23): blueprint-compiler, deluge, gexiv2, gimp, gnumeric, gnuradio, gramps, hatari, inkscape, libpeas, linuxcnc, orca, python3-dasbus, python3-pyatspi, rhythmbox, selenium-webdriver-at-spi, switcheroo-control, system-config-printer, tlp-pd, tryton, virt-manager, 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/42_graphics/phase.env && kpkg install python3-gobject'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-gui/python3-gobject.
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-gui/python3-gobject
echo '45068697de3ffe46840ca369705f23118b34db4f7deb63f6eff079a6734ddcca python3-gobject-3.58.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-gobject
SRC=$SRC_ROOT/python3-gobject-3.58.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-gobject-3.58.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:
meson setup build --prefix=/usr --libdir=lib --buildtype=release \
--wrap-mode=nofallback \
-Dpython=python3 \
-Dpycairo=enabled \
-Dtests=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
test -n "$(find "$PKG"/usr/lib/python3*/site-packages/gi -maxdepth 1 -name '_gi.*.so')"
test -n "$(find "$PKG"/usr/lib/python3*/site-packages/gi -maxdepth 1 -name '_gi_cairo.*.so')"
The switches, and why each is set:
-Dpython=python3— The interpreter to build the extension for. The value is upstream’s default.-Dpycairo=enabled— Buildgi._gi_cairo, the converter between cairo’s GObject types and python3-cairo’s Python objects, which a GTK drawing callback written in Python needs. The option’s default isauto, under which a missing cairo leaves the module out and a missing pycairo is not caught at configure;enabledmakes a missing cairo, cairo-gobject or pycairo stop the configure.--wrap-mode=nofallback— The source ships fallback wraps forglib,libffi,gobject-introspectionandpycairo; with this mode none of them is downloaded and built in place of the port, and a missing dependency stops the configure.
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-gobject, 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-gobject-3.58.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-gobject, and runs the triggers its paths call for.
Contents
Installed directories: /usr/include/pygobject-3.0, /usr/lib/python3.14/site-packages/PyGObject-3.58.0.dist-info, /usr/lib/python3.14/site-packages/gi/__pycache__, /usr/lib/python3.14/site-packages/gi/repository, /usr/share/licenses/python3-gobject.
Short descriptions
pygobject-3.0.pc |
Python bindings for GObject |
Notes
The two test lines after the install stop the build unless the package holds both compiled modules, _gi.*.so and _gi_cairo.*.so, so no PyGObject without cairo support can ship.
pythoncapi-compat, a header-only compatibility layer for the CPython C API, is built from the copy upstream includes under subprojects/ in the release tarball. It is the one subproject the build uses, and --wrap-mode=nofallback does not stop it, because meson.build calls it with subproject() rather than as a dependency() fallback.