Skip to content

Drop the printers crate; print via lp/lpstat CLI (no CUPS link) - #6

Merged
physwkim merged 1 commit into
mainfrom
chore/drop-printers-cups
Jul 19, 2026
Merged

physwkim merged 1 commit into
mainfrom
chore/drop-printers-cups

Conversation

@physwkim

Copy link
Copy Markdown
Owner

Drop the printers crate — print via lp/lpstat CLI (no CUPS link)

Why

The toolbar Print action depended on the printers crate, which links CUPS
(-lcups) on Linux. That made libcups2-dev a build-time requirement for the
whole workspace: rsplot, rsdm, and adl2rsdm all link rsplot, so even the
adl2rsdm converter's test suite (cargo test -p adl2rsdm) failed to link
without it (rust-lld: error: unable to find library -lcups).

What

Replace the crate with a small CLI shell-out so a default build links no CUPS library:

  • New print_cli module: system_printers() (lpstat -e), default_printer()
    (lpstat -d), spool_file() (lp -d <printer>). Missing lp/lpstat
    (e.g. Windows) → empty list / no default, which callers already treat as
    "no destination".
  • The print dialog's enumeration and the print_graph / print_graph_to /
    print_to_printer submit path route through it. Public print_graph /
    print_graph_to signatures unchanged.
  • Drop printers from Cargo.toml and libcups2-dev from the CI apt list.
  • CHANGELOG [Unreleased].

Behavior change

Printing now requires lp/lpstat on PATH (CUPS on Linux/macOS). Platforms
without them (e.g. Windows) lose the print path the printers crate previously
provided via winspool. Public API signatures are unchanged. Recorded in the
CHANGELOG.

Verified (cups-free, on a machine without libcups.so)

  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace --no-run — every test binary links, no -lcups
  • rsplot lib 1625 / 0, rsdm lib 339 / 0, adl2rsdm (lib 140, bin 3,
    compiles.rs 5, opens.rs 2) — all pass

…UPS link)

The toolbar Print action depended on the `printers` crate, which links CUPS
(`-lcups`) on Linux. That forced `libcups2-dev` at build time for the entire
workspace — rsplot, rsdm, and adl2rsdm all link rsplot, so even the adl2rsdm
converter's test suite failed to link without it.

Replace the crate with a small command-line shell-out to `lp` / `lpstat` so a
default build links no CUPS library:

- New `print_cli` module: `system_printers()` (`lpstat -e`), `default_printer()`
  (`lpstat -d`), `spool_file()` (`lp -d <printer>`). When `lp`/`lpstat` are
  absent (e.g. Windows) it degrades to an empty list / no default, which the
  callers already treat as "no destination".
- The print dialog's enumeration and the `print_graph` / `print_graph_to` /
  `print_to_printer` submit path route through it; the public
  `print_graph` / `print_graph_to` signatures are unchanged.
- Drop `printers` from Cargo.toml and `libcups2-dev` from the CI apt list.
- CHANGELOG [Unreleased]: Changed + Removed.

Behavior change: printing now requires lp/lpstat on PATH (CUPS on Linux/macOS);
platforms without them (e.g. Windows) lose the print path that the printers
crate previously provided via winspool.

Verified cups-free on a machine without libcups.so: `cargo clippy --workspace
--all-targets -- -D warnings` clean; `cargo test --workspace --no-run` links
every test binary with no -lcups; rsplot lib 1625, rsdm lib 339, and the
adl2rsdm suite (lib 140, bin 3, compiles.rs 5, opens.rs 2) all pass.
@physwkim
physwkim force-pushed the chore/drop-printers-cups branch from 6ba8e78 to fced114 Compare July 19, 2026 11:25
@physwkim
physwkim merged commit 365ade7 into main Jul 19, 2026
4 checks 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