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/coredata.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/coredata.py')
-rw-r--r-- | mesonbuild/coredata.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index a0ee7df..97edeb2 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -481,8 +481,8 @@ class CoreData: # the contents of that file into the meson private (scratch) # directory so that it can be re-read when wiping/reconfiguring copy = os.path.join(scratch_dir, f'{uuid.uuid4()}.{ftype}.ini') - with open(f) as rf: - with open(copy, 'w') as wf: + with open(f, encoding='utf-8') as rf: + with open(copy, 'w', encoding='utf-8') as wf: wf.write(rf.read()) real.append(copy) @@ -973,7 +973,7 @@ def write_cmd_line_file(build_dir: str, options: argparse.Namespace) -> None: config['options'] = {str(k): str(v) for k, v in options.cmd_line_options.items()} config['properties'] = properties - with open(filename, 'w') as f: + with open(filename, 'w', encoding='utf-8') as f: config.write(f) def update_cmd_line_file(build_dir: str, options: argparse.Namespace): @@ -981,7 +981,7 @@ def update_cmd_line_file(build_dir: str, options: argparse.Namespace): config = CmdLineFileParser() config.read(filename) config['options'].update({str(k): str(v) for k, v in options.cmd_line_options.items()}) - with open(filename, 'w') as f: + with open(filename, 'w', encoding='utf-8') as f: config.write(f) def get_cmd_line_options(build_dir: str, options: argparse.Namespace) -> str: |