fix(release): revert post-collect binary filter, keep strip+optimize only (#14)

The binary-filter hack from PR #13 broke Tauri's resource walker on
Linux:

    resource path `.../dist/omnivoice-backend/_internal/libcufft.so.11`
    doesn't exist

PyInstaller's accounting (hook-generated rerun manifests, resource
glob expansion) still referenced the files after they were filtered
out of `a.binaries`, so Tauri's build.rs saw a path that didn't
exist on disk. Removing the post-hoc filter drops that error.

Keep strip=True + optimize=2 — those alone should still shave hundreds
of MB from native libs + bytecode. If the CPU-only torch wheel (PR #11)
+ these two flags aren't enough to get under 2 GB on Linux/Windows,
the next step is splitting the backend into a separately-downloaded
payload rather than trying to force it into one installer asset.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Palash Debnath
2026-04-23 03:42:39 +05:30
committed by GitHub
co-authored by Claude Opus 4.7
parent d29db18214
commit f2539b6719
-24
View File
@@ -186,30 +186,6 @@ a = Analysis(
optimize=2,
)
# Post-hoc binary filter: even on CPU-only torch wheels, collect_all pulls
# a few large libraries the desktop runtime never touches. Drop them by
# substring match on the archive name — PyInstaller re-runs when any of
# these return False, so be precise (no matching "cuda" would eat too much).
_DROP_BINARY_PATTERNS = (
# nvidia wheels (already in excludes, but collect_all can still pull their
# .so/.dll via torch's linker hints)
'libcudart.', 'libcublas.', 'libcublasLt.', 'libcudnn',
'libcurand.', 'libcufft.', 'libcusolver.', 'libcusparse.',
'libnccl.', 'libnvToolsExt.', 'libnvrtc.', 'libnvjitlink.',
'cudart64_', 'cublas64_', 'cublasLt64_', 'cudnn64_',
'curand64_', 'cufft64_', 'cusolver64_', 'cusparse64_',
# torch training / JIT runtimes not used by inference.
'libtorch_cuda', 'torch_cuda.', 'torch_cuda_linalg.',
# onnxruntime CUDA provider (we use CPU provider only).
'onnxruntime_providers_cuda', 'onnxruntime_providers_tensorrt',
)
def _keep_binary(entry):
name = entry[0].lower()
return not any(pat.lower() in name for pat in _DROP_BINARY_PATTERNS)
a.binaries = [b for b in a.binaries if _keep_binary(b)]
pyz = PYZ(a.pure)
exe = EXE(