Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: chrome/browser/sync/protocol/proto2_to_oproto.py

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """ Strip a .proto of options not supported by open-source protobuf tools. """
6
7 import re
8 import sys
9
10 if __name__ == '__main__':
11 if len(sys.argv) != 3:
12 print "Usage: %s input_file output_file " % sys.argv[0]
13 sys.exit(1)
14
15 input_file = sys.argv[1]
16 output_file = sys.argv[2]
17
18 protobuf = open(input_file).read()
19
20 # Comment out lines like "option java_api_version = 1;"
21 protobuf = re.sub("(option .*api_version.*\=.*)", r"// \1", protobuf)
22
23 # Comment out lines like "option java_java5_enums = false;"
24 protobuf = re.sub("(option .*java_java5_enums.*\=.*)", r"// \1", protobuf)
25
26 # Comment out the java package.
27 protobuf = re.sub("(option .*java_package.*\=.*)", r"// \1", protobuf)
28
29 open(output_file, "w").write(protobuf)
30
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698