diff options
author | Jason Ekstrand <[email protected]> | 2017-09-19 16:05:35 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-10-25 16:14:09 -0700 |
commit | 3720d913dd39852be7debfa17823f730a77bb478 (patch) | |
tree | a15367b6c3e5c8d1ccbe6b4e0c5c8e68f0018083 /src/intel | |
parent | e0519294c7f416beb726d0e1463520f3166637d6 (diff) |
anv/entrypoints: Dump useful data if mako throws an exception
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_entrypoints_gen.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index ac1c193c631..23bc8542184 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -371,11 +371,23 @@ def main(): # For outputting entrypoints.h we generate a anv_EntryPoint() prototype # per entry point. - with open(os.path.join(args.outdir, 'anv_entrypoints.h'), 'wb') as f: - f.write(TEMPLATE_H.render(entrypoints=entrypoints, - filename=os.path.basename(__file__))) - with open(os.path.join(args.outdir, 'anv_entrypoints.c'), 'wb') as f: - f.write(gen_code(entrypoints)) + try: + with open(os.path.join(args.outdir, 'anv_entrypoints.h'), 'wb') as f: + f.write(TEMPLATE_H.render(entrypoints=entrypoints, + filename=os.path.basename(__file__))) + with open(os.path.join(args.outdir, 'anv_entrypoints.c'), 'wb') as f: + f.write(gen_code(entrypoints)) + except Exception: + # In the even there's an error this imports some helpers from mako + # to print a useful stack trace and prints it, then exits with + # status 1, if python is run with debug; otherwise it just raises + # the exception + if __debug__: + import sys + from mako import exceptions + sys.stderr.write(exceptions.text_error_template().render() + '\n') + sys.exit(1) + raise if __name__ == '__main__': |