Skip to content

Test the pieusb backend in CI, and ship it on Windows - #816

Merged
marcinz606 merged 1 commit into
mainfrom
fix/pieusb-ci-and-windows-packaging
Aug 12, 2026
Merged

Test the pieusb backend in CI, and ship it on Windows#816
marcinz606 merged 1 commit into
mainfrom
fix/pieusb-ci-and-windows-packaging

Conversation

@marcinz606

Copy link
Copy Markdown
Owner

The pieusb backend landed in #747 with tests that never run and a Windows build that never contains it. Three config fixes, no behaviour change.

CI never ran the pieusb tests

ci.yml installed only the dev group, so both pieusb test files importorskip'd away and the suite reported green while covering none of the backend. pieusb is pure Python plus a bundled libusb — no system package needed.

before: 0 passed, 2 skipped
after:  20 passed, 1 skipped

tests/scanners/test_pieusb_autoexposure.py is the remaining skip and CI cannot fix it: it imports pieusb.calibration, which does not exist in pieusb==0.3.7, the pinned floor. It also tests only upstream library internals, no NegPy code. Worth deleting separately.

Windows shipped the Scan tab with no backend

The Windows release step ran uv sync --no-group scanner, which was a no-op: there is no default-groups setting, so uv installs dev alone and scanner was never in to begin with. pieusb was left out with it. Since #747 removed the _ScanUnsupportedPlaceholder gate, Windows shipped a Scan tab where both backend factories raise ScannerUnavailable.

Now uv sync --all-groups --no-group scanner — everything except SANE, which genuinely has no Windows build.

PyInstaller missed the libusb pieusb needs

libusb_package's own PyInstaller hook does collect_dynamic_libs(..., destdir='.'), putting the bundled library at the bundle root. But get_library_path() resolves it with importlib_resources.files('libusb_package') — the package directory. Verified with two probe builds:

without --collect-all:  LIBPATH: None
with    --collect-all:  LIBPATH: .../_internal/libusb_package/libusb-1.0.so

The without build still got a backend on Linux only because ctypes.util.find_library fell through to the host's system libusb. Windows has none, so get_backend() would return None and no scanner would ever enumerate.

Also confirmed PyInstaller exits 0 on --collect-all for an uninstalled package, so a local build without the group degrades exactly like gphoto2 does — no conditional needed.

Verification

  • ruff check and ruff format clean
  • Full suite in the CI-equivalent env: one pre-existing unrelated failure, test_stitch.py::test_stitch_real_rgb_triplet_samples (stale load_linear_preview_rgb call signature, same on main, sample-gated so CI skips it)

The pieusb backend landed with tests that never ran and a Windows build
that never contained it.

CI installed only the dev group, so both pieusb test files skipped at
import and the suite reported green while covering none of the backend.
pieusb is pure Python plus a bundled libusb, so it needs no system
package to install.

The Windows release step ran `uv sync --no-group scanner`, which was a
no-op: there is no default-groups setting, so uv installs dev alone and
scanner was never in. pieusb was left out with it, so the Scan tab
shipped on Windows with no backend it could reach.

PyInstaller also missed the libusb that pieusb needs. libusb_package's
own hook copies the bundled library to the bundle root, but
get_library_path() resolves it with importlib_resources against the
package directory, so the lookup found nothing and pyusb fell back to a
system libusb that Windows does not have. --collect-all puts the library
where the lookup actually looks.

tests/scanners/test_pieusb_autoexposure.py still skips: it imports
pieusb.calibration, which does not exist in pieusb 0.3.7.
@marcinz606
marcinz606 merged commit c6f07d4 into main Aug 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant