Browse Source

Update ProtoWrappers.py for Python 3

pull/218/head
nielsandriesse 3 years ago
parent
commit
b12937ef00
  1. 13
      Scripts/ProtoWrappers.py

13
Scripts/ProtoWrappers.py

@ -6,7 +6,6 @@ import sys
import subprocess
import datetime
import argparse
import commands
import re
@ -1130,7 +1129,7 @@ def preserve_validation_logic(args, proto_file_path, dst_file_path):
if len(validation_block) > 0:
if args.verbose:
print 'Preserving validation logic for:', name
print('Preserving validation logic for:', name)
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 args.verbose:
print '# Ignoring syntax'
print('# Ignoring syntax')
continue
if option_regex.search(line):
if args.verbose:
print '# Ignoring option'
print('# Ignoring option')
continue
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()
if args.verbose:
print '# package:', args.package
print('# package:', args.package)
continue
message_regex = re.compile(r'^message\s+(.+?)\s+\{$')
@ -1213,7 +1212,7 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.verbose:
print 'args:', args
print('args:', args)
proto_file_path = os.path.abspath(os.path.join(args.proto_dir, args.proto_file))
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)
if args.verbose:
print 'dst_file_path:', dst_file_path
print('dst_file_path:', dst_file_path)
args.package = None
process_proto_file(args, proto_file_path, dst_file_path)

Loading…
Cancel
Save