From ba5464c4b4f836b3203c8a4ef48ed2fa249733e5 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 5 Aug 2015 11:39:16 +0200 Subject: [PATCH] Better handle invalid files --- build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.py b/build.py index 2b9bed8..46ccfe6 100644 --- a/build.py +++ b/build.py @@ -91,10 +91,17 @@ for device_file in os.listdir('devices'): # Resolve version image to the corresponding file for version in device['versions']: for image_type, filename in version['images'].items(): + found = False for file in device['images']: if file['filename'] == filename: version['images'][image_type] = copy.copy(file) version['images'][image_type]["type"] = image_type + found = True + break + if not found: + log.critical('Image for {} {} with filename {} is missing'.format(device["name"], version["name"], file['filename'])) + sys.exit(1) + render('device.html', os.path.join('devices', out_filename + '.html'), device=device) devices.append(device)