| Message ID | 20251211175908.3952420-3-ross.burton@arm.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/3] oeqa: open JSON to parse in a context manager | expand |
diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build index edbcd48355a..b391f3b9254 100755 --- a/scripts/oe-setup-build +++ b/scripts/oe-setup-build @@ -21,7 +21,10 @@ def discover_templates(layers_file): raise Exception("List of layers {} does not exist; were the layers set up using the setup-layers script or bitbake-setup tool?".format(layers_file)) templates = [] - layers_list = json.load(open(layers_file))["layers"] + + with open(layers_file) as f: + layers_list = json.load(f)["layers"] + for layer in layers_list: template_dir = os.path.join(os.path.dirname(layers_file), layer, 'conf','templates') if os.path.exists(template_dir):
Use a context manager to avoid warnings about unclosed files. Signed-off-by: Ross Burton <ross.burton@arm.com> --- scripts/oe-setup-build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)