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

224.2. python3-cairo-1.29.1

Cairo drawing for Python, and the cairo half of PyGObject

1.29.1-1 · LGPL-2.1-only OR MPL-1.1 · 0.3 SBU · 551.2 KiB, 12 files · 42_graphics, 128 of 189 · ports/core/python-gui/python3-cairo

Homepage: https://pycairo.readthedocs.io/

pycairo is the Python binding for the cairo 2D drawing library: the cairo module with its surfaces, contexts and patterns. Besides programs that draw with it directly, it is the cairo half of python3-gobject: GTK’s drawing callbacks hand Python a cairo.Context, and PyGObject converts it through the C API that pycairo installs as a header and the py3cairo.pc pkg-config file.

Depends on: python3, meson, ninja, pkgconf, cairo.

Required by (11): breeze-gtk, deluge, gimp, gnuradio, gramps, linuxcnc, orca, python3-gobject, system-config-printer, tryton, virt-manager.

Sources: python3-cairo-1.29.1.tar.gz (650.7 KiB). Every step kpkg takes applies to this port.

Install: script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install python3-cairo'

build.sh:

meson setup build --prefix=/usr --libdir=lib --buildtype=release \
	-Dpython=python3 \
	-Dtests=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

test -n "$(find "$PKG"/usr/lib/python3*/site-packages/cairo -maxdepth 1 -name '_cairo.*.so')"
test -f "$PKG"/usr/lib/pkgconfig/py3cairo.pc

Directories: /usr/include/pycairo, /usr/lib/python3.14/site-packages/cairo, /usr/lib/python3.14/site-packages/pycairo-1.29.1.dist-info, /usr/share/licenses/python3-cairo.

The two test lines after the install stop the build unless the package holds the compiled _cairo.*.so module and /usr/lib/pkgconfig/py3cairo.pc. python3-gobject looks for pycairo first by locating the cairo module and the include/ directory installed beside it, and falls back to py3cairo.pc. The pkg-config file points at the second copy of the header, under /usr/include/pycairo.