]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oe-setup-build: use context manager when loading JSON
authorRoss Burton <ross.burton@arm.com>
Thu, 11 Dec 2025 17:59:08 +0000 (17:59 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 15 Dec 2025 18:00:31 +0000 (18:00 +0000)
Use a context manager to avoid warnings about unclosed files.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/oe-setup-build

index edbcd48355a5f55b58f4a4982ca1395215fd7742..b391f3b92547b8d8cc371796b7c2992957ad29ce 100755 (executable)
@@ -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):