Test the pieusb backend in CI, and ship it on Windows - #816
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlinstalled only thedevgroup, so both pieusb test filesimportorskip'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.tests/scanners/test_pieusb_autoexposure.pyis the remaining skip and CI cannot fix it: it importspieusb.calibration, which does not exist inpieusb==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 nodefault-groupssetting, so uv installsdevalone andscannerwas never in to begin with.pieusbwas left out with it. Since #747 removed the_ScanUnsupportedPlaceholdergate, Windows shipped a Scan tab where both backend factories raiseScannerUnavailable.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 doescollect_dynamic_libs(..., destdir='.'), putting the bundled library at the bundle root. Butget_library_path()resolves it withimportlib_resources.files('libusb_package')— the package directory. Verified with two probe builds:The
withoutbuild still got a backend on Linux only becausectypes.util.find_libraryfell through to the host's system libusb. Windows has none, soget_backend()would returnNoneand no scanner would ever enumerate.Also confirmed PyInstaller exits 0 on
--collect-allfor an uninstalled package, so a local build without the group degrades exactly like gphoto2 does — no conditional needed.Verification
ruff checkandruff formatcleantest_stitch.py::test_stitch_real_rgb_triplet_samples(staleload_linear_preview_rgbcall signature, same onmain, sample-gated so CI skips it)