SCons: Ensure with statement where applicable

This commit is contained in:
Thaddeus Crews 2024-03-10 12:09:48 -05:00
parent 0ace0a1292
commit fb299d0fb1
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
21 changed files with 1649 additions and 1699 deletions

View file

@ -124,17 +124,15 @@ def generate_export_icons(platform_path, platform_name):
svg_names.append("run_icon")
for name in svg_names:
svgf = open(export_path + "/" + name + ".svg", "rb")
b = svgf.read(1)
svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "'
while len(b) == 1:
svg_str += "\\" + hex(ord(b))[1:]
with open(export_path + "/" + name + ".svg", "rb") as svgf:
b = svgf.read(1)
svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "'
while len(b) == 1:
svg_str += "\\" + hex(ord(b))[1:]
b = svgf.read(1)
svg_str += '";\n'
svgf.close()
svg_str += '";\n'
# NOTE: It is safe to generate this file here, since this is still executed serially.
wf = export_path + "/" + name + "_svg.gen.h"