dropbox / pb-jelly

A protobuf code generation framework for the Rust language developed at Dropbox.
Apache License 2.0
611 stars 25 forks source link

Attempt to fix pb-jelly-gen #142

Closed goffrie closed 1 year ago

goffrie commented 1 year ago
  1. Instead of trying to install a matching version of protobuf to the installed protoc, which no longer works as of version 3.21 (where the python major version was bumped to 4), let's always install a pinned version (currently set to the latest version 4.21.12).
    • In case the system version of protoc is not compatible with said pinned version, we don't generate rust/extensions_pb2.py at runtime but rather check it into the repo.
    • This should improve compatibility with protoc versions as we strictly only depend on the stdin/stdout interface when interfacing with non-pinned versions.
    • We still use whatever Python version is installed on the system so we're still vulnerable to the whims of the user's Python environment in that way. Oh well.
  2. For whatever reason that I couldn't figure out, we can no longer import codegen from the protoc-gen-rust script generated by pip. Hackily work around that by pointing PYTHONPATH to the tempdir where we unpacked the vendored Python files.