diff mbox series

[3/3] oe-setup-build: use context manager when loading JSON

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

Commit Message

Ross Burton Dec. 11, 2025, 5:59 p.m. UTC
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(-)
diff mbox series

Patch

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):