Skip to content

Instantly share code, notes, and snippets.

@nodirt
Created November 20, 2017 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodirt/24a14c7c3656dd89dd0e9da1cbecc50f to your computer and use it in GitHub Desktop.
Save nodirt/24a14c7c3656dd89dd0e9da1cbecc50f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
from google.protobuf.compiler import plugin_pb2 as plugin
def generate_code(req):
res = plugin.CodeGeneratorResponse()
for input in req.proto_file:
output = res.file.add(
name=input.name.replace('.proto', '_prpc_pb2.py'),
content='# generated',
)
return res
def main():
data = sys.stdin.read()
req = plugin.CodeGeneratorRequest()
req.ParseFromString(data)
res = generate_code(request, response)
sys.stdout.write(response.SerializeToString())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment