Invoke Protocol Compiler to generate python from given source .proto.
(source, python_out, proto_path)
| 34 | |
| 35 | |
| 36 | def compile_proto(source, python_out, proto_path): |
| 37 | """Invoke Protocol Compiler to generate python from given source .proto.""" |
| 38 | if not protoc: |
| 39 | sys.exit('protoc not found. Is the protobuf-compiler installed?\n') |
| 40 | |
| 41 | protoc_command = [ |
| 42 | protoc, |
| 43 | '--proto_path', proto_path, |
| 44 | '--python_out', python_out, |
| 45 | source, |
| 46 | ] |
| 47 | if subprocess.call(protoc_command) != 0: |
| 48 | sys.exit('Make sure your protoc version >= 2.6. You can use a custom ' |
| 49 | 'protoc by setting the PROTOC environment variable.') |
| 50 | |
| 51 | |
| 52 | class BuildPy(build_py): |