280.2. python3-wxpython-4.2.5
The wxWidgets GTK 3 toolkit for Python programs such as CHIRP and Pronterface
| Version | 4.2.5, release 2 |
| Shelf | python-gui — python3-* GUI toolkit, desktop and D-Bus bindings |
| Phase | 43_toolkits (Toolkits), 264 of 344 in build order |
| Licence | LGPL-2.0-or-later WITH WxWindows-exception-3.1 |
| Homepage | https://wxpython.org/ |
| Build time | 28.6 SBU |
| Installed size | 58.5 MiB in 743 files |
| Recipe | ports/core/python-gui/python3-wxpython/kpkgbuild |
About
wxPython is the Python binding of wxWidgets, the wx package, built here against the tree’s GTK 3 wxWidgets rather than a copy of its own. Python programs written in wx import it; in the tree, CHIRP and KiCad depend on it. The binding’s C++ sources, generated by SIP, ship in the release archive under sip/cpp, so the build compiles them and runs no SIP. The SVG module wx.svg._nanosvg ships only as Cython source, which python3-cython translates during the build.
Sources
python3-wxpython-4.2.5.tar.gz(56.0 MiB)
sha25644e836d1bccd99c38790bb034b6ecf70d9060f6734320560f7c4b0d006144793
upstream: https://files.pythonhosted.org/packages/source/w/wxpython/wxpython-4.2.5.tar.gz
archive copy: sources-4/python-gui--python3-wxpython-4.2.5.tar.gz
Dependencies
Depends on: python3, python3-setuptools, python3-cython, wxwidgets, gtk3, numpy, python3-pillow, python3-six.
Required by (2): chirp, kicad.
Patches
build.sh applies these; kpkg applies nothing by itself.
no-stacktrace.patch— in the generated binding forwxAppTraits, makesGetAssertStackTrace()return an empty string instead of calling the wxWidgets method. wxWidgets declares that method only withwxUSE_STACKWALKER, which its configure turns off whenbacktrace()and<execinfo.h>are missing, as they are on musl; the generated code would otherwise call a method the installed headers do not declare.
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/43_toolkits/phase.env && kpkg install python3-wxpython'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-gui/python3-wxpython.
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-wxpython
echo '44e836d1bccd99c38790bb034b6ecf70d9060f6734320560f7c4b0d006144793 python3-wxpython-4.2.5.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-wxpython
SRC=$SRC_ROOT/python3-wxpython-4.2.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-wxpython-4.2.5.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 recipe’s helpers series and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export LDFLAGS="$LDFLAGS -Wl,--strip-debug"
patch -p1 -i "$PORT_SRC/no-stacktrace.patch"
python3 build.py build_py --use_syswx --gtk3 --release --jobs="$KDOS_JOBS"
python3 build.py install --use_syswx --gtk3 --release --destdir="$PKG" \
--extra_setup="--prefix=/usr"
test -n "$(find "$PKG"/usr/lib/python3*/site-packages/wx -maxdepth 1 -name '_core.*.so')"
test -n "$(find "$PKG"/usr/lib/python3*/site-packages/wx/svg -maxdepth 1 -name '_nanosvg.*.so')"
test -z "$(readelf -S "$(find "$PKG"/usr/lib/python3*/site-packages/wx -maxdepth 1 -name '_core.*.so')" | grep '\.debug_info')"
The switches, and why each is set:
--use_syswx— build against the wxWidgets already installed, found through itswx-config, and skip building and installing the copy in wxPython’s source tree. It implies--no_magic, so no wxWidgets libraries are bundled into the package.--gtk3— the GTK 3 port of wxWidgets, the one wxwidgets is built as. Upstream’s default, named.--release— mark the build as a release: the generatedwx/__version__.pyrecords the build type asreleaserather thandevelopment, whichwx.PlatformInforeports.--jobs="$KDOS_JOBS"— compile with the tree’s job count.--destdir="$PKG"— with--extra_setup="--prefix=/usr": install into the staging directory, whichbuild.pyhands tosetup.py installas--root, under the/usrprefix.-Wl,--strip-debug— appended toLDFLAGS: drop debug information at the link. wxPython’s waf build adds-gto every compile of the extension modules, so without it each.sowould carry its debug sections;build.shchecks that_corehas no.debug_info.
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-wxpython, 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-wxpython-4.2.5-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-wxpython, and runs the triggers its paths call for.
Contents
Installed programs: helpviewer, img2png, img2py, img2xpm, pycrust, pyshell, pyslices, pyslicesshell, pywxrc, wxdemo, wxdocs, wxget.
Installed directories: /usr/lib/python3.14/site-packages/wx, /usr/lib/python3.14/site-packages/wxPython-4.2.5-py3.14.egg-info, /usr/share/licenses/python3-wxpython.
Notes
After the install, build.sh checks that the core extension wx/_core.*.so and the SVG module wx/svg/_nanosvg.*.so are in the package, so a build that skipped either fails rather than shipping a wx package that cannot be imported.