Skip to content

Bundle protobuf so the RPM/deb work on Fedora (and any distro)#1

Open
GaimsDevSoftware wants to merge 1 commit into
mainfrom
fix/bundle-protobuf
Open

Bundle protobuf so the RPM/deb work on Fedora (and any distro)#1
GaimsDevSoftware wants to merge 1 commit into
mainfrom
fix/bundle-protobuf

Conversation

@GaimsDevSoftware

Copy link
Copy Markdown
Owner

Problem

The installed RPM crashed on launch on Fedora:

ImportError: cannot import name 'builder' from 'google.protobuf.internal'

The bundled androidtvremote2 ships generated *_pb2.py that import google.protobuf.internal.builder, which only exists in protobuf >= 3.20. Fedora ships python3-protobuf 3.19.6, so the dependency declared by the package is too old and the app can't import its remote protocol layer.

Fix

Treat protobuf the same way we already treat androidtvremote2 and aiofiles — bundle it from the build venv instead of trusting the distro:

  • cp -a "$SITE/google" → /opt/tellykeys/lib/ in both build-rpm and build-deb.
  • Strip the arch-specific C extension (find … -name '*.so' -delete) and force the pure-Python implementation in the launcher (PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python) so the package stays noarch / Architecture: all.
  • Drop python3-protobuf from the RPM Requires and the deb Depends.
  • Add a google presence check to the existing "run pip install -e ." guard.

python3-cryptography stays a system dependency on purpose — it has a compiled extension, so vendoring it would break noarch.

Verification

Reproduced the crash with Fedora's protobuf 3.19.6, then confirmed the app launches (tellykeys --help exits 0) with protobuf 5.29.6 vendored into /opt/tellykeys/lib, its .so removed, and the pure-Python implementation forced.

🤖 Generated with Claude Code

The bundled androidtvremote2 ships generated *_pb2.py that import
google.protobuf.internal.builder, which only exists in protobuf >= 3.20.
Fedora's python3-protobuf is 3.19.6, so the installed app crashed on
startup with "cannot import name 'builder'".

Vendor protobuf into /opt/tellykeys/lib (alongside androidtvremote2 and
aiofiles), strip its arch-specific C extension, and force the pure-Python
implementation in the launcher so the package stays noarch /
Architecture: all. Drop the now-unnecessary python3-protobuf dependency
from both the RPM spec and the deb control.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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