OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Litify a .proto file. | |
7 | |
8 This program add a line | |
9 "option optimize_for = LITE_RUNTIME;" | |
10 to the input .proto file. | |
11 | |
12 Run it like: | |
13 litify_proto_file.py input.proto output.proto | |
14 """ | |
15 | |
16 import fileinput | |
17 import sys | |
18 | |
19 | |
20 def main(argv): | |
21 if len(argv) != 3: | |
22 print 'Usage: litify_proto_file.py [input] [output]' | |
23 return 1 | |
24 output_file = open(sys.argv[2], 'w') | |
25 for line in fileinput.input(sys.argv[1]): | |
26 output_file.write(line) | |
27 | |
28 output_file.write("\noption optimize_for = LITE_RUNTIME;\n") | |
29 return 0 | |
30 | |
31 | |
32 if __name__ == '__main__': | |
33 sys.exit(main(sys.argv)) | |
OLD | NEW |