diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-06-29 20:52:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 20:52:55 +0300 |
commit | 4bfee181c5a166e3d429bd265e06d299dce50f30 (patch) | |
tree | 8918a0e09f668ed55748ec254c51b4d92b5403a9 /mesonbuild/cmake | |
parent | 81ca0ec7ae975723b8b399b9f142286895a45dab (diff) | |
parent | c0a2025d038a08092212bfc45e7bbb46ff1e8e52 (diff) | |
download | meson-4bfee181c5a166e3d429bd265e06d299dce50f30.zip meson-4bfee181c5a166e3d429bd265e06d299dce50f30.tar.gz meson-4bfee181c5a166e3d429bd265e06d299dce50f30.tar.bz2 |
Merge pull request #8918 from mensinda/pathlibFixes
pathlib: Patch pathlib to work around some bugs (fixes #8263 #7295)
Diffstat (limited to 'mesonbuild/cmake')
-rw-r--r-- | mesonbuild/cmake/fileapi.py | 6 | ||||
-rw-r--r-- | mesonbuild/cmake/toolchain.py | 8 | ||||
-rw-r--r-- | mesonbuild/cmake/traceparser.py | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/cmake/fileapi.py b/mesonbuild/cmake/fileapi.py index 6773e9a..5d4d01a 100644 --- a/mesonbuild/cmake/fileapi.py +++ b/mesonbuild/cmake/fileapi.py @@ -51,7 +51,7 @@ class CMakeFileAPI: } query_file = self.request_dir / 'query.json' - query_file.write_text(json.dumps(query, indent=2)) + query_file.write_text(json.dumps(query, indent=2), encoding='utf-8') def load_reply(self) -> None: if not self.reply_dir.is_dir(): @@ -75,7 +75,7 @@ class CMakeFileAPI: # Debug output debug_json = self.build_dir / '..' / 'fileAPI.json' debug_json = debug_json.resolve() - debug_json.write_text(json.dumps(index, indent=2)) + debug_json.write_text(json.dumps(index, indent=2), encoding='utf-8') mlog.cmd_ci_include(debug_json.as_posix()) # parse the JSON @@ -313,7 +313,7 @@ class CMakeFileAPI: if not real_path.exists(): raise CMakeException(f'File "{real_path}" does not exist') - data = json.loads(real_path.read_text()) + data = json.loads(real_path.read_text(encoding='utf-8')) assert isinstance(data, dict) for i in data.keys(): assert isinstance(i, str) diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py index f3e487d..1a6dcf0 100644 --- a/mesonbuild/cmake/toolchain.py +++ b/mesonbuild/cmake/toolchain.py @@ -66,8 +66,8 @@ class CMakeToolchain: def write(self) -> Path: if not self.toolchain_file.parent.exists(): self.toolchain_file.parent.mkdir(parents=True) - self.toolchain_file.write_text(self.generate()) - self.cmcache_file.write_text(self.generate_cache()) + self.toolchain_file.write_text(self.generate(), encoding='utf-8') + self.cmcache_file.write_text(self.generate_cache(), encoding='utf-8') mlog.cmd_ci_include(self.toolchain_file.as_posix()) return self.toolchain_file @@ -215,11 +215,11 @@ class CMakeToolchain: build_dir = Path(self.env.scratch_dir) / '__CMake_compiler_info__' build_dir.mkdir(parents=True, exist_ok=True) cmake_file = build_dir / 'CMakeLists.txt' - cmake_file.write_text(cmake_content) + cmake_file.write_text(cmake_content, encoding='utf-8') # Generate the temporary toolchain file temp_toolchain_file = build_dir / 'CMakeMesonTempToolchainFile.cmake' - temp_toolchain_file.write_text(CMakeToolchain._print_vars(self.variables)) + temp_toolchain_file.write_text(CMakeToolchain._print_vars(self.variables), encoding='utf-8') # Configure trace = CMakeTraceParser(self.cmakebin.version(), build_dir) diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py index 23a1852..42ceec6 100644 --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -158,7 +158,7 @@ class CMakeTraceParser: if not self.requires_stderr(): if not self.trace_file_path.exists and not self.trace_file_path.is_file(): raise CMakeException('CMake: Trace file "{}" not found'.format(str(self.trace_file_path))) - trace = self.trace_file_path.read_text(errors='ignore') + trace = self.trace_file_path.read_text(errors='ignore', encoding='utf-8') if not trace: raise CMakeException('CMake: The CMake trace was not provided or is empty') |