From a127c338d4e90971b4750d8d45d8e4e534c32e1b Mon Sep 17 00:00:00 2001 From: cottongin Date: Thu, 19 Nov 2026 18:08:07 -0500 Subject: [PATCH] feat(packaging): add arm64 deb builder, APPLaunch desktop/icon, and packaging tests --- packaging/Dockerfile.arm64 | 32 ++++ packaging/build-deb.sh | 150 ++++++++++++++++++ packaging/czcamera.desktop | 8 + packaging/czcamera.png | Bin 0 -> 1543 bytes packaging/debian/control | 11 ++ packaging/debian/postinst | 9 ++ packaging/debian/prerm | 12 ++ packaging/tests/test_packaging.py | 244 ++++++++++++++++++++++++++++++ 8 files changed, 466 insertions(+) create mode 100644 packaging/Dockerfile.arm64 create mode 100755 packaging/build-deb.sh create mode 100644 packaging/czcamera.desktop create mode 100644 packaging/czcamera.png create mode 100644 packaging/debian/control create mode 100755 packaging/debian/postinst create mode 100755 packaging/debian/prerm create mode 100644 packaging/tests/test_packaging.py diff --git a/packaging/Dockerfile.arm64 b/packaging/Dockerfile.arm64 new file mode 100644 index 0000000..27080b0 --- /dev/null +++ b/packaging/Dockerfile.arm64 @@ -0,0 +1,32 @@ +FROM --platform=linux/arm64 debian:bookworm-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + pkg-config \ + libjpeg62-turbo-dev \ + libfreetype-dev \ + dpkg-dev \ + python3 \ + ffmpeg \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY app /app/app +COPY cam-helper /app/cam-helper +COPY packaging /app/packaging + +RUN rm -rf /app/app/build /app/app/build-arm64 \ + && cmake -S /app/app -B /app/app/build-arm64 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O2" \ + -DCZ_BUILD_APP=ON \ + -DCZ_TARGET_DEVICE=ON \ + -DCZ_BUILD_TESTS=ON \ + && cmake --build /app/app/build-arm64 -j"$(nproc)" \ + && ctest --test-dir /app/app/build-arm64 --output-on-failure \ + && PYTHONPATH=/app/cam-helper python3 -W error -m unittest discover -s /app/cam-helper/tests -v \ + && /app/packaging/build-deb.sh --local --bin /app/app/build-arm64/czcamera diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh new file mode 100755 index 0000000..e89954b --- /dev/null +++ b/packaging/build-deb.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" + +PKG_FILENAME="czcamera_1.0.0_m5stack1_arm64.deb" +OUT_DIR="${SCRIPT_DIR}/dist" +STAGE_ONLY_DIR="" +LOCAL_BUILD=0 +CZ_BIN="" + +usage() { + cat < Stage .deb directory tree into and exit + --bin Path to prebuilt czcamera binary + --ui-bin Alias for --bin + --out-dir Output directory for .deb (default: packaging/dist) + -h, --help Show this help message +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --local) + LOCAL_BUILD=1 + shift + ;; + --stage-only) + [[ $# -ge 2 ]] || { echo "Missing argument for --stage-only" >&2; exit 2; } + STAGE_ONLY_DIR="$2" + shift 2 + ;; + --bin|--ui-bin) + [[ $# -ge 2 ]] || { echo "Missing argument for $1" >&2; exit 2; } + CZ_BIN="$2" + shift 2 + ;; + --out-dir) + [[ $# -ge 2 ]] || { echo "Missing argument for --out-dir" >&2; exit 2; } + OUT_DIR="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +stage_package_tree() { + local stage_dir="$1" + local cz_bin="$2" + + rm -rf "${stage_dir}" + install -d "${stage_dir}/DEBIAN" + install -d "${stage_dir}/usr/bin" + install -d "${stage_dir}/usr/lib/czcamera/czcamera_cam" + install -d "${stage_dir}/usr/share/APPLaunch/applications" + install -d "${stage_dir}/usr/share/APPLaunch/share/images" + + install -m 0644 "${SCRIPT_DIR}/debian/control" "${stage_dir}/DEBIAN/control" + install -m 0755 "${SCRIPT_DIR}/debian/postinst" "${stage_dir}/DEBIAN/postinst" + install -m 0755 "${SCRIPT_DIR}/debian/prerm" "${stage_dir}/DEBIAN/prerm" + + install -m 0755 "${cz_bin}" "${stage_dir}/usr/bin/czcamera" + install -m 0755 "${ROOT_DIR}/cam-helper/bin/czcamera-cam" "${stage_dir}/usr/bin/czcamera-cam" + + while IFS= read -r -d '' py_file; do + local rel_path="${py_file#${ROOT_DIR}/cam-helper/czcamera_cam/}" + install -d "${stage_dir}/usr/lib/czcamera/czcamera_cam/$(dirname "${rel_path}")" + install -m 0644 "${py_file}" "${stage_dir}/usr/lib/czcamera/czcamera_cam/${rel_path}" + done < <(find "${ROOT_DIR}/cam-helper/czcamera_cam" -type f -name '*.py' -print0) + + install -m 0644 "${SCRIPT_DIR}/czcamera.desktop" "${stage_dir}/usr/share/APPLaunch/applications/czcamera.desktop" + install -m 0644 "${SCRIPT_DIR}/czcamera.png" "${stage_dir}/usr/share/APPLaunch/share/images/czcamera.png" + + for font_dir in "${ROOT_DIR}/app/assets/fonts" "${SCRIPT_DIR}/fonts"; do + if [[ -d "${font_dir}" ]]; then + while IFS= read -r -d '' font_file; do + install -d "${stage_dir}/usr/share/czcamera/fonts" + install -m 0644 "${font_file}" "${stage_dir}/usr/share/czcamera/fonts/$(basename "${font_file}")" + done < <(find "${font_dir}" -maxdepth 1 -type f \( -name '*.ttf' -o -name '*.otf' \) -print0) + fi + done +} + +resolve_cz_bin() { + if [[ -n "${CZ_BIN}" ]]; then + [[ -f "${CZ_BIN}" ]] || { echo "Specified binary not found: ${CZ_BIN}" >&2; exit 1; } + echo "${CZ_BIN}" + return + fi + for candidate in "${ROOT_DIR}/app/build-arm64/czcamera" "${ROOT_DIR}/app/build/czcamera"; do + if [[ -f "${candidate}" ]]; then + echo "${candidate}" + return + fi + done + echo "" +} + +if [[ -n "${STAGE_ONLY_DIR}" ]]; then + RESOLVED_BIN="$(resolve_cz_bin)" + [[ -n "${RESOLVED_BIN}" ]] || { echo "czcamera binary not found; pass --bin (or --ui-bin )" >&2; exit 1; } + stage_package_tree "${STAGE_ONLY_DIR}" "${RESOLVED_BIN}" + echo "Staged package tree at ${STAGE_ONLY_DIR}" + exit 0 +fi + +if [[ "${LOCAL_BUILD}" -eq 1 ]]; then + if [[ -z "${CZ_BIN}" ]]; then + BUILD_DIR="${ROOT_DIR}/app/build-arm64" + cmake -S "${ROOT_DIR}/app" -B "${BUILD_DIR}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O2" \ + -DCZ_BUILD_APP=ON \ + -DCZ_TARGET_DEVICE=ON \ + -DCZ_BUILD_TESTS=ON + cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 2)" + ctest --test-dir "${BUILD_DIR}" --output-on-failure + CZ_BIN="${BUILD_DIR}/czcamera" + fi + + TMP_STAGE="$(mktemp -d)" + trap 'rm -rf "${TMP_STAGE}"' EXIT + stage_package_tree "${TMP_STAGE}/pkg" "${CZ_BIN}" + + mkdir -p "${OUT_DIR}" + dpkg-deb --build --root-owner-group "${TMP_STAGE}/pkg" "${OUT_DIR}/${PKG_FILENAME}" + echo "Built ${OUT_DIR}/${PKG_FILENAME}" + exit 0 +fi + +# Default: build inside linux/arm64 Debian Bookworm Docker container +IMAGE_TAG="czcamera-deb-builder:arm64" +docker build --platform linux/arm64 -f "${SCRIPT_DIR}/Dockerfile.arm64" -t "${IMAGE_TAG}" "${ROOT_DIR}" + +mkdir -p "${OUT_DIR}" +CONTAINER_ID="$(docker create --platform linux/arm64 "${IMAGE_TAG}")" +trap 'docker rm -f "${CONTAINER_ID}" >/dev/null 2>&1 || true' EXIT +docker cp "${CONTAINER_ID}:/app/packaging/dist/${PKG_FILENAME}" "${OUT_DIR}/${PKG_FILENAME}" +echo "Built ${OUT_DIR}/${PKG_FILENAME}" diff --git a/packaging/czcamera.desktop b/packaging/czcamera.desktop new file mode 100644 index 0000000..1629590 --- /dev/null +++ b/packaging/czcamera.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=czcamera +Comment=Camera, video, timelapse, and gallery for CardputerZero +Exec=/usr/bin/czcamera +Icon=/usr/share/APPLaunch/share/images/czcamera.png +Terminal=false +Categories=AudioVideo;Photography; diff --git a/packaging/czcamera.png b/packaging/czcamera.png new file mode 100644 index 0000000000000000000000000000000000000000..a525e7970f7ccbfbd884bc89eb083ac9bc58ea14 GIT binary patch literal 1543 zcmV+i2Kf1jP)d?#2rf`faS(4T*wAeB!%NR zf546N1K6pt;M5L~T8*4ajbLDN&rw4h$vcuu-HCVP5_ln++}oRZJae=6!MSwFyv!?7 zuUxJWD-_D@a=F&6)f&f*#)t1WH$PHQ6t?37zTgwS1qN-eCu+4ZFoKI1zKV4+(mT5M=(>A(#O2C#t1)Bp)x=r21w5iDRb6}(cZ zY8Q-UOxtnk3=`N)OkD<2;tjY#!2~vAQ(4w|2AI2Ko#+bBD&H{^ebYrDtVRG93Z*t* z=JQ2saL&j@u<6x@QroR~bg4F(OwMSGU<51IrHds4X@X$nx};&TNRAsw;{_vFjQ~8W zFb2{D!3b6cV3Ywqd-l6}_wGM+dV1=Mn2R|>0I+HeS_@P->KC|S^&kdoKa4y9TIE@# z(`$iBB5!y1mT%YZm`frtX!~I_SAY^NeqRKYc@01V&;T?54Zw&3+}nGo4i692$;nAz zOO;uLP1uHw0RzlxtJT`FjSCwzFJUV-&*JMufT>hgTLO>2ckcXPpKyomUN1Ibo72`= zeDxh5DIo@h5u6)Hfr#yM2PnqyzZ*7KpZxT-`uxfF_Fw1c*g9(z`VLSEhF{TlYSFirE#d|*EyJ_bE+_(Qe?2CUpqfiRV+yVNvEV+C4M|E&;FtGqIhOuKG z6slJT;EDKrc-a$qfLE`6YDbw9(wjGbtLM-EP>&vUZ1JAYoMYIAZ9@jIVhze@={x{Q z$+vI+>CXYEt*vc!`SOaZ_>M6$o^8F-dRz(*0@U*tMxg*m^a#A8qa$_u_IIA(hQ(O6 z5r|%q=v71l16V9pR5F>-(yRa_Z2{pGbt@|$*z$@-fyi95p8Dzf3!}LMqzK4%!;x37 zZ>nbVV++t1YG>ygTfA>Hu8hEBTbXB4VOc1EQf)b&If2}}*H-)czp75>iMo07mX(^H z+1lRzvJaAdI=7KyB6BVUKo0t{jWczLJm5Wj`kQ+E_!o8k`py8TYPH#i=!`_>kok1h ziID}!f>@R+PC%qBkq5j^XWxDTVEDKv5J_j}=d#3M?hpV>Ye^R%XBBSgOJtF@M4lTw z5$ViWw=`yMeSmuY&K;msUlz#DYD;8syqmOyVGLuPY0O-@)z|^+7y^08hfykmzc)<&zh(r#c*D{8bl*O|f#GsZjkpnnxAL)s&XPcu8Le zpsv62ySdN+4C1CzqyUEXw&tXp>vCIj?f}DlW8F*68|wi8Ols-DgT2T;+JWu5{`w9O zMfKsLS$quy;I(V5$UWYM&4B=n$CERQlz9C*yboAn8#bQD$3OutgABl+0M_f9@3~ZC zAdMG{U^N2Js#3>Ps(3tMG)8BQ%SL~2ozIuLbm=jW#tTNU8UdKi=Io{uJj!oCxeGSE zwlKNTrW1)oDkhip4J>!b<$PGV_KqPm84!ylj9k=f3sdTPb}mXLGcAci18h(deK4BT zH_&cA#?RXgxSn7E6WC1E!L3rM(OlNrc-6=fEMPKq|G;E2-D0swgVtq-2Lo8ZM5~Ks zDwWw~L+JO?dAY#hGrq$B7Blrxg*u@tckGr0p4@rEckRe?FD!+A8)PQuXP=7(4W9&D zuV56;-v)Vbp`C77RjBLe0&brda&>|p%uy7!pY_6WfGc+KHL#B6@pv+3ozk?~QMp_@ t<`@yxR`A%45BP#l_-2~@n^&}6{{x}7@O4?`nv(zk002ovPDHLkV1gdp +Depends: python3 (>= 3.9), python3-picamera2, ffmpeg, alsa-utils, libjpeg62-turbo | libjpeg8, libfreetype6, libc6, libstdc++6 +Description: Camera application for CardputerZero (photo, video, timelapse, gallery) + Fullscreen 320x170 fbdev/evdev camera application (czcamera) and Picamera2 + subprocess worker (czcamera-cam) with 9 RGB24 filters, timelapse capture + and MP4 assembly, gallery viewer, and on-device video playback. diff --git a/packaging/debian/postinst b/packaging/debian/postinst new file mode 100755 index 0000000..6824acb --- /dev/null +++ b/packaging/debian/postinst @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +case "$1" in + configure|abort-upgrade|abort-remove|abort-deconfigure) + ;; +esac + +exit 0 diff --git a/packaging/debian/prerm b/packaging/debian/prerm new file mode 100755 index 0000000..925bb8c --- /dev/null +++ b/packaging/debian/prerm @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +case "$1" in + remove|deconfigure) + if [ -d /usr/lib/czcamera ]; then + find /usr/lib/czcamera -depth -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true + fi + ;; +esac + +exit 0 diff --git a/packaging/tests/test_packaging.py b/packaging/tests/test_packaging.py new file mode 100644 index 0000000..eeaefd4 --- /dev/null +++ b/packaging/tests/test_packaging.py @@ -0,0 +1,244 @@ +import os +import stat +import struct +import subprocess +import tempfile +import unittest +import zlib +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +PACKAGING_DIR = ROOT / "packaging" + + +def _parse_png_chunks(data: bytes) -> list[tuple[bytes, bytes]]: + if data[:8] != b"\x89PNG\r\n\x1a\n": + raise ValueError("Invalid PNG signature") + pos = 8 + chunks: list[tuple[bytes, bytes]] = [] + while pos + 12 <= len(data): + length = struct.unpack(">I", data[pos : pos + 4])[0] + chunk_type = data[pos + 4 : pos + 8] + chunk_data = data[pos + 8 : pos + 8 + length] + crc_expected = struct.unpack( + ">I", data[pos + 8 + length : pos + 12 + length] + )[0] + crc_actual = zlib.crc32(chunk_type + chunk_data) & 0xFFFFFFFF + if crc_expected != crc_actual: + raise ValueError(f"CRC mismatch in chunk {chunk_type!r}") + chunks.append((chunk_type, chunk_data)) + pos += 12 + length + if chunk_type == b"IEND": + break + return chunks + + +class TestPackaging(unittest.TestCase): + def test_debian_control(self) -> None: + ctrl = (PACKAGING_DIR / "debian" / "control").read_text(encoding="utf-8") + self.assertIn("Package: czcamera", ctrl) + self.assertIn("Version: 1.0.0-m5stack1", ctrl) + self.assertIn("Architecture: arm64", ctrl) + self.assertIn("Depends:", ctrl) + for dep in ( + "python3", + "python3-picamera2", + "ffmpeg", + "alsa-utils", + "libjpeg62-turbo | libjpeg8", + "libfreetype6", + "libc6", + "libstdc++6", + ): + self.assertIn(dep, ctrl) + self.assertNotIn("cp0-sync", ctrl) + self.assertNotIn("libcamera0", ctrl) + self.assertNotIn("${", ctrl) + + def test_desktop_entry_and_icon_80x80(self) -> None: + desktop = (PACKAGING_DIR / "czcamera.desktop").read_text(encoding="utf-8") + self.assertIn("Type=Application", desktop) + self.assertIn("Name=czcamera", desktop) + self.assertIn("Exec=/usr/bin/czcamera", desktop) + self.assertIn( + "Icon=/usr/share/APPLaunch/share/images/czcamera.png", desktop + ) + self.assertIn("Terminal=false", desktop) + self.assertIn("Categories=AudioVideo;Photography;", desktop) + + png = (PACKAGING_DIR / "czcamera.png").read_bytes() + self.assertEqual(png[:8], b"\x89PNG\r\n\x1a\n") + width, height, bit_depth, color_type = struct.unpack(">IIBB", png[16:26]) + self.assertEqual(width, 80) + self.assertEqual(height, 80) + self.assertEqual(bit_depth, 8) + self.assertIn(color_type, (2, 6)) + + chunks = _parse_png_chunks(png) + chunk_types = [t for t, _ in chunks] + self.assertIn(b"IHDR", chunk_types) + self.assertIn(b"IDAT", chunk_types) + self.assertEqual(chunk_types[-1], b"IEND") + + idat_payload = b"".join(d for t, d in chunks if t == b"IDAT") + raw_pixels = zlib.decompress(idat_payload) + channels = 4 if color_type == 6 else 3 + self.assertEqual(len(raw_pixels), 80 * (1 + 80 * channels)) + + def test_maintainer_scripts_and_dockerfile_arm64(self) -> None: + postinst_path = PACKAGING_DIR / "debian" / "postinst" + prerm_path = PACKAGING_DIR / "debian" / "prerm" + + for script_path in (postinst_path, prerm_path): + mode = script_path.stat().st_mode + self.assertEqual( + stat.S_IMODE(mode) & 0o755, + 0o755, + f"{script_path} must be executable", + ) + syntax = subprocess.run( + ["sh", "-n", str(script_path)], + capture_output=True, + text=True, + check=False, + ) + self.assertEqual( + syntax.returncode, 0, f"sh -n failed on {script_path}: {syntax.stderr}" + ) + text = script_path.read_text(encoding="utf-8") + self.assertIn("set -e", text) + self.assertNotIn("systemctl", text) + self.assertNotIn("cp0-sync", text) + + prerm = prerm_path.read_text(encoding="utf-8") + self.assertIn("/usr/lib/czcamera", prerm) + self.assertIn("__pycache__", prerm) + # Ensure recursive cleanup (find ... or rm -rf ...) + self.assertTrue( + "find /usr/lib/czcamera" in prerm or "rm -rf" in prerm, + "prerm must recursively clean __pycache__ under /usr/lib/czcamera", + ) + + dockerfile = (PACKAGING_DIR / "Dockerfile.arm64").read_text( + encoding="utf-8" + ) + self.assertIn("--platform=linux/arm64", dockerfile) + self.assertIn("debian:bookworm-slim", dockerfile) + for pkg in ( + "build-essential", + "cmake", + "pkg-config", + "libjpeg62-turbo-dev", + "libfreetype-dev", + "dpkg-dev", + "python3", + "ffmpeg", + ): + self.assertIn(pkg, dockerfile) + self.assertNotIn("libcamera-dev", dockerfile) + self.assertNotIn("libsqlite3-dev", dockerfile) + self.assertIn("-DCZ_BUILD_APP=ON", dockerfile) + self.assertIn("-DCZ_TARGET_DEVICE=ON", dockerfile) + self.assertIn("-DCZ_BUILD_TESTS=ON", dockerfile) + self.assertIn("ctest", dockerfile) + self.assertIn("cam-helper/tests", dockerfile) + self.assertIn("build-deb.sh --local", dockerfile) + + def test_build_deb_stage_only(self) -> None: + build_script = PACKAGING_DIR / "build-deb.sh" + mode = build_script.stat().st_mode + self.assertEqual( + stat.S_IMODE(mode) & 0o755, + 0o755, + "build-deb.sh must be executable", + ) + + syntax = subprocess.run( + ["bash", "-n", str(build_script)], + capture_output=True, + text=True, + check=False, + ) + self.assertEqual( + syntax.returncode, 0, f"bash -n failed: {syntax.stderr}" + ) + + script_text = build_script.read_text(encoding="utf-8") + self.assertIn("czcamera_1.0.0_m5stack1_arm64.deb", script_text) + self.assertIn("--bin", script_text) + self.assertIn("--ui-bin", script_text) + + for flag in ("--ui-bin", "--bin"): + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + dummy_bin = tmp_path / "czcamera" + dummy_bin.write_bytes(b"#!/bin/sh\nexit 0\n") + dummy_bin.chmod(0o755) + + stage_dir = tmp_path / "stage" + res = subprocess.run( + [ + str(build_script), + "--stage-only", + str(stage_dir), + flag, + str(dummy_bin), + ], + capture_output=True, + text=True, + check=False, + ) + self.assertEqual( + res.returncode, + 0, + f"--stage-only with {flag} failed:\nSTDOUT:\n{res.stdout}\nSTDERR:\n{res.stderr}", + ) + + expected_files = [ + stage_dir / "DEBIAN" / "control", + stage_dir / "DEBIAN" / "postinst", + stage_dir / "DEBIAN" / "prerm", + stage_dir / "usr" / "bin" / "czcamera", + stage_dir / "usr" / "bin" / "czcamera-cam", + stage_dir / "usr" / "lib" / "czcamera" / "czcamera_cam" / "__init__.py", + stage_dir / "usr" / "lib" / "czcamera" / "czcamera_cam" / "protocol.py", + stage_dir / "usr" / "lib" / "czcamera" / "czcamera_cam" / "picam2_worker.py", + stage_dir / "usr" / "share" / "APPLaunch" / "applications" / "czcamera.desktop", + stage_dir / "usr" / "share" / "APPLaunch" / "share" / "images" / "czcamera.png", + ] + for fpath in expected_files: + self.assertTrue(fpath.is_file(), f"Missing staged file: {fpath}") + + exec_paths = { + stage_dir / "DEBIAN" / "postinst", + stage_dir / "DEBIAN" / "prerm", + stage_dir / "usr" / "bin" / "czcamera", + stage_dir / "usr" / "bin" / "czcamera-cam", + } + for exec_path in exec_paths: + self.assertEqual( + stat.S_IMODE(exec_path.stat().st_mode), + 0o755, + f"Expected 0755 on {exec_path}", + ) + for non_exec_path in set(expected_files) - exec_paths: + self.assertEqual( + stat.S_IMODE(non_exec_path.stat().st_mode), + 0o644, + f"Expected 0644 on {non_exec_path}", + ) + + pycache_dirs = list( + (stage_dir / "usr" / "lib" / "czcamera").rglob("__pycache__") + ) + self.assertEqual( + pycache_dirs, [], "Staged Python tree must not contain __pycache__" + ) + self.assertFalse( + (stage_dir / "usr" / "lib" / "systemd").exists(), + "czcamera must not install systemd units", + ) + + +if __name__ == "__main__": + unittest.main()