From b94cbbfb79eaeaf863d77fca1dd051b102471ad3 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 6 Jan 2025 12:23:02 -0800 Subject: templates: use a proper context manager with open --- mesonbuild/templates/mesontemplates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/templates/mesontemplates.py b/mesonbuild/templates/mesontemplates.py index 83239648c..76f56a1a0 100644 --- a/mesonbuild/templates/mesontemplates.py +++ b/mesonbuild/templates/mesontemplates.py @@ -61,5 +61,6 @@ def create_meson_build(options: Arguments) -> None: sourcespec=sourcespec, depspec=depspec, default_options=formatted_default_options) - open('meson.build', 'w', encoding='utf-8').write(content) + with open('meson.build', 'w', encoding='utf-8') as f: + f.write(content) print('Generated meson.build file:\n\n' + content) -- cgit v1.2.3