Use a context manager to avoid warnings about unclosed files.
Signed-off-by: Ross Burton <[email protected]>
---
scripts/oe-setup-build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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):
--
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#227563):
https://lists.openembedded.org/g/openembedded-core/message/227563
Mute This Topic: https://lists.openembedded.org/mt/116733245/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-