122.1. printrun-2.2.0
pronsole and printcore — send a sliced job to a printer over USB serial
The build-state snapshot was taken from 2.2.0-1; this recipe is 2.2.0-2, so the size, time and contents below describe the earlier build.
| Version | 2.2.0, release 2 |
| Shelf | fabrication — 3D-printing slicers and hosts, and CNC control |
| Phase | 41_system (System), 493 of 1047 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://github.com/kliment/Printrun |
| Build time | 0.3 SBU |
| Installed size | 2.3 MiB in 127 files |
| Recipe | ports/core/fabrication/printrun/kpkgbuild |
About
Printrun is host software for 3D printers that take G-code over a serial line, as most Marlin, Prusa and RepRap firmware does. The port installs its console half: pronsole, an interactive console that connects to the printer, sends a sliced job and reports progress and temperatures, and printcore, the library and command under it, which streams a G-code file to a printer with no interface at all. With a slicer it is what sends the job down the USB cable. The printer’s port is a USB serial device, which the dialout group opens; the kdos user is in it through fs/etc/group.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/fabrication.txt:
The stick can slice and had no way to send: pronsole pushes the gcode down a USB serial line. Needs the dialout group, which fs/etc/group already grants.
Sources
printrun-2.2.0.tar.gz(1.0 MiB)
sha2564a2c25106db139a940aa45cf04ddeedf2afd775801c0ec6f008886230e1b5e3b
upstream: https://github.com/kliment/Printrun/archive/refs/tags/printrun-2.2.0.tar.gz
archive copy: sources-2/fabrication--printrun-2.2.0.tar.gz
Dependencies
Depends on: python3, python3-setuptools, python3-pip, python3-cython, python3-pyserial, python3-platformdirs, python3-psutil.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
no-wx-on-console.patch— Import settings without wxPython, for the console client
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/41_system/phase.env && kpkg install printrun'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/fabrication/printrun.
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/fabrication/printrun
echo '4a2c25106db139a940aa45cf04ddeedf2afd775801c0ec6f008886230e1b5e3b printrun-2.2.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/printrun
SRC=$SRC_ROOT/printrun-2.2.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf printrun-2.2.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:
patch -p1 -i "$PORT_SRC/no-wx-on-console.patch"
pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr .
rm -f $PKG/usr/bin/pronterface.py $PKG/usr/bin/plater.py
rm -f $PKG/usr/bin/__pycache__/pronterface.*.pyc $PKG/usr/bin/__pycache__/plater.*.pyc
rm -f $PKG/usr/share/applications/pronterface.desktop \
$PKG/usr/share/applications/plater.desktop \
$PKG/usr/share/applications/pronsole.desktop \
$PKG/usr/share/metainfo/pronterface.appdata.xml \
$PKG/usr/share/metainfo/plater.appdata.xml
ln -s pronsole.py $PKG/usr/bin/pronsole
ln -s printcore.py $PKG/usr/bin/printcore
cat > "$PKG/usr/share/applications/pronsole.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Pronsole
GenericName=3D Printing Console
Comment=Send G-code to a RepRap machine and follow the print from a terminal
Exec=pronsole
Icon=pronsole
Terminal=true
Categories=Utility;Graphics;3DGraphics;ConsoleOnly;
Keywords=3d;printing;reprap;gcode;g-code;printrun;pronsole;
DESKTOP
chmod 644 "$PKG/usr/share/applications/pronsole.desktop"
The switches, and why each is set:
--no-build-isolation— pip builds the package with thesetuptoolsandcythonalready installed instead of fetching them into an isolated environment; both are ports independs(python3-setuptools, python3-cython), and Cython compiles theprintrun.gcoder_lineextension, the G-code line parser.--no-deps,--no-index— Install Printrun alone, with nothing resolved or downloaded. Itsrequirements.txtnames the graphical front end’s dependencies as well (wxPython, pyglet, numpy, lxml, puremagic, dbus-python); the console path imports onlyserial,platformdirsandpsutil, which are ports independs.
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/printrun, 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 printrun-2.2.0-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/printrun, and runs the triggers its paths call for.
Contents
Installed programs: printcore, printcore.py, pronsole, pronsole.py.
Installed directories: /usr/lib/python3.14/site-packages/printrun, /usr/lib/python3.14/site-packages/printrun-2.2.0.dist-info, /usr/share/licenses/printrun, /usr/share/pronterface.
Notes
- The console imports no wx.
pronsoleimports its settings fromprintrun/settings.py, which upstream opens withimport wxand whoseComboSettingtakes its default width from the GUI’sget_spaceas a default argument, evaluated when the class is defined.no-wx-on-console.patchmakes thewximport optional and works the width out when the widget is built, so the module imports, andpronsolestarts, with no wxPython installed; a call that builds a settings widget is the one place that still needs it. - The graphical front ends are removed.
pronterface.pyandplater.py, with their compiled caches, desktop entries and AppStream files, are deleted from the package. Their 3D and projector views import pyglet and puremagic, which the tree does not carry, so they would be commands on thePATH, and entries in Start, that fail on an import. pronsoleandprintcorewithout the suffix. Upstream installs its programs as the scriptssetup.pylists,pronsole.pyandprintcore.py; the recipe addspronsoleandprintcoreas links to them, so both run by their bare names.pronsole.desktopis the recipe’s own, written in place of upstream’s, and runspronsolein a terminal. Upstream’s is named “Printer console”, which the launcher’s fuzzy search ranks first for “Printers”, ahead of the Printers settings page; KDOS’s says “3D Printing Console” and keeps “printer” out of every searched field.- The sleep inhibit is optional. During a print
pronsoleasksorg.freedesktop.ScreenSaverover D-Bus to hold off the idle lock, inside atrythat goes on without it. dbus-python is not in this port’sdepends, and without itpronsoleprints with no inhibit. psutil is used to raise the process’s priority while it prints, as far as theRLIMIT_NICElimit allows.