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 /tools/cmake2meson.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 'tools/cmake2meson.py')
-rwxr-xr-x | tools/cmake2meson.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index 4185b5a..a12d9cf 100755 --- a/tools/cmake2meson.py +++ b/tools/cmake2meson.py @@ -280,13 +280,13 @@ class Converter: subdir = self.cmake_root cfile = Path(subdir).expanduser() / 'CMakeLists.txt' try: - with cfile.open() as f: + with cfile.open(encoding='utf-8') as f: cmakecode = f.read() except FileNotFoundError: print('\nWarning: No CMakeLists.txt in', subdir, '\n', file=sys.stderr) return p = Parser(cmakecode) - with (subdir / 'meson.build').open('w') as outfile: + with (subdir / 'meson.build').open('w', encoding='utf-8') as outfile: for t in p.parse(): if t.name == 'add_subdirectory': # print('\nRecursing to subdir', @@ -300,7 +300,7 @@ class Converter: def write_options(self) -> None: filename = self.cmake_root / 'meson_options.txt' - with filename.open('w') as optfile: + with filename.open('w', encoding='utf-8') as optfile: for o in self.options: (optname, description, default) = o if default is None: |