1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

add size reporting to res_collect tool

This commit is contained in:
Pavol Rusnak 2016-10-03 11:56:24 +02:00
parent d7398619e1
commit 3fe688e9b4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -2,6 +2,7 @@
import os import os
resources = {} resources = {}
resources_size = 0
os.chdir(os.path.dirname(__file__)) os.chdir(os.path.dirname(__file__))
os.chdir('../src/') os.chdir('../src/')
@ -11,9 +12,12 @@ def process_file(name):
return return
if name.endswith('.py'): if name.endswith('.py'):
return return
print('processing file %s' % name)
with open(name, 'rb') as f: with open(name, 'rb') as f:
resources[name] = f.read() data = f.read()
resources[name] = data
print('processing file %s (%d bytes)' % (name, len(data)))
global resources_size
resources_size += len(data)
# scan common resources # scan common resources
for res in os.listdir('trezor/res/'): for res in os.listdir('trezor/res/'):
@ -37,4 +41,4 @@ with open(resfile, 'wt') as f:
f.write(" '%s': %s,\n" % (k, resources[k])) f.write(" '%s': %s,\n" % (k, resources[k]))
f.write('}\n') f.write('}\n')
print('written %s with %d entries' % (resfile, len(resources))) print('written %s with %d entries (total %d bytes)' % (resfile, len(resources), resources_size))