I believe I ran into this issue as well - https://github.com/google/protobuf/issues/881?
On Monday, March 29, 2010 at 11:59:01 AM UTC-7, Kenton Varda wrote: > > Yeah, there's really no way to accomplish this without editing the .proto > files you are importing. This is an issue in regular old Python as well > (or many other languages): you can't really fix someone else's poor > package layout without editing their code. I guess it's a bigger problem > in protobufs because people working in C++ may make decisions that aren't > so bad for C++ but are poor for Python. > > Instead of actually maintaining forks, you could write a sed script which > automatically fixes up the other project's .proto files and have your build > system automatically run this script. > > On Mon, Mar 29, 2010 at 10:00 AM, John Admanski <[email protected] > <javascript:>> wrote: > >> I have a situation where I want to make use of protocol buffers defined >> in a separate source tree; but when I compile the protobufs into python >> code all the compiled code assumes it's going to be exposed by putting it >> onto sys.path somehow (via one of the usual mechanisms). The problem is >> that due to the way the protobufs are defined in the original source tree >> this adds a bunch of new top-level packages and generally pollutes the >> global module namespace. >> >> So I wanted to work around this by putting all the compiled protobufs >> into a package, but this doesn't work with protoc; it assumes that if a >> protobuf references X/Y/Z.proto, then there's going to be an X.Y.Z_pb2 >> module it can import. I can fix this by editing all the proto files to >> change all the references to be relative to this new package I'm defining >> but that basically means I have to fork the proto files from this other >> project. >> >> Is there any better mechanism when compiling protobufs that would allow >> me to put the compiled output into a package, rather than having to hang >> them off of sys.path or tweak all the proto files? >> >> -- John >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Protocol Buffers" group. >> To post to this group, send email to [email protected] >> <javascript:>. >> To unsubscribe from this group, send email to >> [email protected] <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/protobuf?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
