From: Ross Burton Date: Thu, 11 Dec 2025 17:59:08 +0000 (+0000) Subject: oe-setup-build: use context manager when loading JSON X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bafc79639fa2fe3efc8895eccf447b3ed7f17dda;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git oe-setup-build: use context manager when loading JSON Use a context manager to avoid warnings about unclosed files. Signed-off-by: Ross Burton Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build index edbcd48355..b391f3b925 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):