Skip to content

Commit 84740b3

Browse files
Shorten status message
1 parent 9e62074 commit 84740b3

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

utils/archive_build_size.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def get_status(url, context):
8282
for status in data:
8383
if status['context'] == context:
8484
return status['description']
85+
for status in data:
86+
# Legacy support
87+
if status['context'] == "image_size/" + context:
88+
return status['description']
8589
return None
8690

8791

@@ -97,7 +101,7 @@ def get_pr_info(slug, pull_number):
97101

98102
def get_context(filename):
99103
"""Define status context"""
100-
return "image_size/" + filename
104+
return filename
101105

102106

103107
def get_base_size(filename):
@@ -123,17 +127,18 @@ def format_description(current_size, previous_size):
123127
rom_delta = current_size.rom - previous_size.rom
124128
ram_delta = current_size.ram - previous_size.ram
125129
return (
126-
u'ROM: {:,.0f}b \u0394: {:+,.0f}b/{:+0.2f}% '
127-
u'RAM: {:,.0f}b \u0394: {:+,.0f}b/{:+0.2f}%'.format(
130+
u'ROM: {:,.0f} \u0394: {:+,.0f}b/{:+0.2f}% '
131+
u'RAM: {:,.0f} \u0394: {:+,.0f}b/{:+0.2f}%'.format(
128132
current_size.rom, rom_delta, 100.0 * rom_delta / current_size.rom,
129133
current_size.ram, ram_delta, 100.0 * ram_delta / current_size.ram))
130134

131-
return 'ROM: {:,.0f}b RAM: {:,.0f}b'.format(current_size.rom, current_size.ram)
135+
return 'ROM: {:,.0f} RAM: {:,.0f}'.format(current_size.rom, current_size.ram)
132136

133137

134138
def parse_description(description):
135139
"""Parse size info from existsing status"""
136-
match = re.search(r'ROM:\s*([0-9,]+)b.*\sRAM:\s*([0-9,]+)b', description)
140+
141+
match = re.search(r'ROM:\s*([0-9,]+).*\sRAM:\s*([0-9,]+)', description)
137142
assert match, 'Unable to parse "%s"' % description
138143
rom_size = int(match.group(1).replace(',', ''))
139144
ram_size = int(match.group(2).replace(',', ''))

0 commit comments

Comments
 (0)