Python3 ios_bin/binary_size.py

This commit is contained in:
Esun Kim 2020-11-12 15:15:41 -08:00
parent 28c795f542
commit bfdfc9eabc
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
#
# Copyright 2018 gRPC authors.
#
@ -143,6 +143,6 @@ for frameworks in [False, True]:
text += '\n No significant differences in binary sizes\n'
text += '\n'
print text
print(text)
check_on_pr.check_on_pr('Binary Size', '```\n%s\n```' % text)

View File

@ -36,7 +36,7 @@ def parse_link_map(filename):
objc_size = 0
protobuf_size = 0
lines = list(open(filename))
lines = open(filename, encoding='utf-8', errors='ignore').readlines()
for line in lines:
line_stripped = line[:-1]
if "# Object files:" == line_stripped:
@ -66,6 +66,8 @@ def parse_link_map(filename):
if len(line_stripped) == 0 or line_stripped[0] == '#':
continue
segs = re.search('^.+?\s+(.+?)\s+(\[.+?\]).*', line_stripped)
if not segs:
continue
target = table_tag[segs.group(2)]
target_stripped = re.search('^(.*?)(\(.+?\))?$', target).group(1)
size = int(segs.group(1), 16)