diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-06-22 22:59:16 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-06-29 11:28:08 +0200 |
commit | 3e396b3782813d36d46195564cd0e111422bcaf5 (patch) | |
tree | f315e990f71984745fcb8f22dac2f0e400fecadb /mesonbuild/backend/backends.py | |
parent | 28175bbee2c111cf41b80c97bbadd7dbabaa8990 (diff) | |
download | meson-3e396b3782813d36d46195564cd0e111422bcaf5.zip meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.gz meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.bz2 |
fix: Always explicitly set encoding for text files (fixes #8263)
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index c489dce..21a6c83 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -374,7 +374,7 @@ class Backend: if not os.path.exists(outfileabs_tmp_dir): os.makedirs(outfileabs_tmp_dir) result.append(unity_src) - return open(outfileabs_tmp, 'w') + return open(outfileabs_tmp, 'w', encoding='utf-8') # For each language, generate unity source files and return the list for comp, srcs in compsrcs.items(): @@ -765,7 +765,7 @@ class Backend: content = f'#include "{os.path.basename(pch_header)}"' pch_file_tmp = pch_file + '.tmp' - with open(pch_file_tmp, 'w') as f: + with open(pch_file_tmp, 'w', encoding='utf-8') as f: f.write(content) mesonlib.replace_if_different(pch_file, pch_file_tmp) return pch_rel_to_build @@ -1019,7 +1019,7 @@ class Backend: ifilename = os.path.join(self.environment.get_build_dir(), 'depmf.json') ofilename = os.path.join(self.environment.get_prefix(), self.build.dep_manifest_name) mfobj = {'type': 'dependency manifest', 'version': '1.0', 'projects': self.build.dep_manifest} - with open(ifilename, 'w') as f: + with open(ifilename, 'w', encoding='utf-8') as f: f.write(json.dumps(mfobj)) # Copy file from, to, and with mode unchanged d.data.append(InstallDataBase(ifilename, ofilename, None, '')) |