Created
November 20, 2017 17:20
-
-
Save nodirt/24a14c7c3656dd89dd0e9da1cbecc50f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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