75.5. python3-adafruit-nrfutil-0.5.3.post16
Serial DFU flasher for nRF52 boards; rnodeconf flashes RAK4631, T-Echo and Heltec T114 RNodes with it
| Version | 0.5.3.post16, release 2 |
| Shelf | python-hw — python3-* hardware, serial, USB, instrument, CAN and device-protocol modules |
| Phase | 40_lang (Languages), 89 of 186 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://github.com/adafruit/Adafruit_nRF52_nrfutil |
| Build time | 0.1 SBU |
| Installed size | 483.7 KiB in 83 files |
| Recipe | ports/core/python-hw/python3-adafruit-nrfutil/kpkgbuild |
About
adafruit-nrfutil is Adafruit’s fork of Nordic’s nrfutil for Python 3: it makes DFU packages for nRF52 boards and flashes them over the board’s serial bootloader. rnode-firmware’s rnodeconf uses it to flash RNodes built on nRF52 boards.
Sources
python3-adafruit-nrfutil-0.5.3.post16.tar.gz(47.9 KiB)
sha256b72103dc8e50f92951f512fc2b6f2c621dac1614531ddf8c0be3b13d020e24ad
upstream: https://files.pythonhosted.org/packages/source/a/adafruit-nrfutil/adafruit-nrfutil-0.5.3.post16.tar.gz
archive copy: sources-4/python-hw--python3-adafruit-nrfutil-0.5.3.post16.tar.gz
Dependencies
Depends on: python3, python3-setuptools, python3-pip, python3-pyserial, python3-click, python3-ecdsa.
Required by (1): rnode-firmware.
Patches
build.sh applies these; kpkg applies nothing by itself.
setup-setuptools.patch— Removes fromsetup.pythe import of setuptools’testcommand and theNoseTestCommandclass andcmdclassentry built on it, and the line that rebindssetuptodistutils.core.setup. setuptools 72 and later have notestcommand, so that import stops the build; Python 3.12 and later have nodistutilsin the standard library, and with that line gonesetup()is setuptools’ own.
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/40_lang/phase.env && kpkg install python3-adafruit-nrfutil'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/python-hw/python3-adafruit-nrfutil.
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-hw/python3-adafruit-nrfutil
echo 'b72103dc8e50f92951f512fc2b6f2c621dac1614531ddf8c0be3b13d020e24ad python3-adafruit-nrfutil-0.5.3.post16.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-adafruit-nrfutil
SRC=$SRC_ROOT/python3-adafruit-nrfutil-0.5.3.post16
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf python3-adafruit-nrfutil-0.5.3.post16.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/setup-setuptools.patch"
pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr .
install -d "$PKG/usr/share/licenses/$name"
head -n 27 nordicsemi/__init__.py > "$PKG/usr/share/licenses/$name/LICENSE"
test -x "$PKG/usr/bin/adafruit-nrfutil"
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-adafruit-nrfutil, 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-adafruit-nrfutil-0.5.3.post16-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-adafruit-nrfutil, and runs the triggers its paths call for.
Contents
Installed programs: adafruit-nrfutil.
Installed directories: /usr/lib/python3.14/site-packages/adafruit_nrfutil-0.5.3.post16.dist-info, /usr/lib/python3.14/site-packages/nordicsemi, /usr/share/licenses/python3-adafruit-nrfutil.
Notes
test -x "$PKG/usr/bin/adafruit-nrfutil" checks that the console script the package exists for was installed.