diff options
Diffstat (limited to 'mesonbuild/templates/dlangtemplates.py')
-rw-r--r-- | mesonbuild/templates/dlangtemplates.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/mesonbuild/templates/dlangtemplates.py b/mesonbuild/templates/dlangtemplates.py index 4aacda8..3d939d8 100644 --- a/mesonbuild/templates/dlangtemplates.py +++ b/mesonbuild/templates/dlangtemplates.py @@ -110,11 +110,12 @@ class DlangProject(SampleImpl): def create_executable(self) -> None: lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower()) source_name = lowercase_token + '.d' - open(source_name, 'w').write(hello_d_template.format(project_name=self.name)) - open('meson.build', 'w').write(hello_d_meson_template.format(project_name=self.name, - exe_name=lowercase_token, - source_name=source_name, - version=self.version)) + open(source_name, 'w', encoding='utf-8').write(hello_d_template.format(project_name=self.name)) + open('meson.build', 'w', encoding='utf-8').write( + hello_d_meson_template.format(project_name=self.name, + exe_name=lowercase_token, + source_name=source_name, + version=self.version)) def create_library(self) -> None: lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower()) @@ -137,6 +138,6 @@ class DlangProject(SampleImpl): 'test_name': lowercase_token, 'version': self.version, } - open(lib_d_name, 'w').write(lib_d_template.format(**kwargs)) - open(test_d_name, 'w').write(lib_d_test_template.format(**kwargs)) - open('meson.build', 'w').write(lib_d_meson_template.format(**kwargs)) + open(lib_d_name, 'w', encoding='utf-8').write(lib_d_template.format(**kwargs)) + open(test_d_name, 'w', encoding='utf-8').write(lib_d_test_template.format(**kwargs)) + open('meson.build', 'w', encoding='utf-8').write(lib_d_meson_template.format(**kwargs)) |