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/rewriter.py | |
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/rewriter.py')
-rw-r--r-- | mesonbuild/rewriter.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py index ddd712f..3f661a4 100644 --- a/mesonbuild/rewriter.py +++ b/mesonbuild/rewriter.py @@ -818,9 +818,9 @@ class Rewriter: fdata = '' # Create an empty file if it does not exist if not os.path.exists(fpath): - with open(fpath, 'w'): + with open(fpath, 'w', encoding='utf-8'): pass - with open(fpath) as fp: + with open(fpath, encoding='utf-8') as fp: fdata = fp.read() # Generate line offsets numbers @@ -871,7 +871,7 @@ class Rewriter: # Write the files back for key, val in files.items(): mlog.log('Rewriting', mlog.yellow(key)) - with open(val['path'], 'w') as fp: + with open(val['path'], 'w', encoding='utf-8') as fp: fp.write(val['raw']) target_operation_map = { @@ -923,7 +923,7 @@ def generate_def_opts(options) -> T.List[dict]: def generate_cmd(options) -> T.List[dict]: if os.path.exists(options.json): - with open(options.json) as fp: + with open(options.json, encoding='utf-8') as fp: return json.load(fp) else: return json.loads(options.json) |