|
|
@ -6,7 +6,6 @@ import sys
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
import datetime
|
|
|
|
import datetime
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
import commands
|
|
|
|
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1130,7 +1129,7 @@ def preserve_validation_logic(args, proto_file_path, dst_file_path):
|
|
|
|
|
|
|
|
|
|
|
|
if len(validation_block) > 0:
|
|
|
|
if len(validation_block) > 0:
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print 'Preserving validation logic for:', name
|
|
|
|
print('Preserving validation logic for:', name)
|
|
|
|
|
|
|
|
|
|
|
|
args.validation_map[name] = validation_block
|
|
|
|
args.validation_map[name] = validation_block
|
|
|
|
|
|
|
|
|
|
|
@ -1160,12 +1159,12 @@ def process_proto_file(args, proto_file_path, dst_file_path):
|
|
|
|
|
|
|
|
|
|
|
|
if syntax_regex.search(line):
|
|
|
|
if syntax_regex.search(line):
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print '# Ignoring syntax'
|
|
|
|
print('# Ignoring syntax')
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if option_regex.search(line):
|
|
|
|
if option_regex.search(line):
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print '# Ignoring option'
|
|
|
|
print('# Ignoring option')
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
package_match = package_regex.search(line)
|
|
|
|
package_match = package_regex.search(line)
|
|
|
@ -1175,7 +1174,7 @@ def process_proto_file(args, proto_file_path, dst_file_path):
|
|
|
|
args.package = package_match.group(1).strip()
|
|
|
|
args.package = package_match.group(1).strip()
|
|
|
|
|
|
|
|
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print '# package:', args.package
|
|
|
|
print('# package:', args.package)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
message_regex = re.compile(r'^message\s+(.+?)\s+\{$')
|
|
|
|
message_regex = re.compile(r'^message\s+(.+?)\s+\{$')
|
|
|
@ -1213,7 +1212,7 @@ if __name__ == "__main__":
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print 'args:', args
|
|
|
|
print('args:', args)
|
|
|
|
|
|
|
|
|
|
|
|
proto_file_path = os.path.abspath(os.path.join(args.proto_dir, args.proto_file))
|
|
|
|
proto_file_path = os.path.abspath(os.path.join(args.proto_dir, args.proto_file))
|
|
|
|
if not os.path.exists(proto_file_path):
|
|
|
|
if not os.path.exists(proto_file_path):
|
|
|
@ -1226,7 +1225,7 @@ if __name__ == "__main__":
|
|
|
|
dst_file_path = os.path.join(dst_dir_path, "%s.swift" % args.wrapper_prefix)
|
|
|
|
dst_file_path = os.path.join(dst_dir_path, "%s.swift" % args.wrapper_prefix)
|
|
|
|
|
|
|
|
|
|
|
|
if args.verbose:
|
|
|
|
if args.verbose:
|
|
|
|
print 'dst_file_path:', dst_file_path
|
|
|
|
print('dst_file_path:', dst_file_path)
|
|
|
|
|
|
|
|
|
|
|
|
args.package = None
|
|
|
|
args.package = None
|
|
|
|
process_proto_file(args, proto_file_path, dst_file_path)
|
|
|
|
process_proto_file(args, proto_file_path, dst_file_path)
|
|
|
|