res_collect now works also on CPython<3.5

This commit is contained in:
slush0 2016-09-27 15:40:57 +02:00 committed by Pavol Rusnak
parent 0637987c09
commit 44479b38d0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
1 changed files with 11 additions and 8 deletions

View File

@ -15,16 +15,19 @@ def process_file(name):
resources[name] = f.read() resources[name] = f.read()
# scan common resources # scan common resources
for res in os.scandir('trezor/res/'): for res in os.listdir('trezor/res/'):
if res.is_file(): name = os.path.join('trezor/res/', res)
process_file('trezor/res/%s' % res.name) if os.path.isfile(name):
process_file(name)
# scan apps # scan apps
for app in os.scandir('apps/'): for app in os.listdir('apps/'):
if app.is_dir() and os.path.isdir('apps/%s/res/' % app.name): name = os.path.join('apps/', app)
for res in os.scandir('apps/%s/res/' % app.name): if os.path.isdir(name) and os.path.isdir('apps/%s/res/' % app):
if res.is_file(): for res in os.listdir('apps/%s/res/' % app):
process_file('apps/%s/res/%s' % (app.name, res.name)) name = 'apps/%s/res/%s' % (app, res)
if os.path.isfile(name):
process_file(name)
resfile = 'trezor/res/resources.py' resfile = 'trezor/res/resources.py'
with open(resfile, 'wt') as f: with open(resfile, 'wt') as f: