diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-07-16 13:45:05 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-07-16 13:45:05 +0200 |
commit | eb3f7215e05a46d02b878ef4a6ba4bef85a1ef6f (patch) | |
tree | e029750e91ae891f1d62cca01f06b9aa43958ff5 | |
parent | 34ed6e739d97ccf03a291527063601ad18704285 (diff) | |
download | glibmm-eb3f7215e05a46d02b878ef4a6ba4bef85a1ef6f.tar.gz |
handle-built-files.py: Specify file encoding on generated files
The default file encoding is platform dependent in Python.
Better specify which encoding is preferred.
-rwxr-xr-x | tools/build_scripts/handle-built-files.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/build_scripts/handle-built-files.py b/tools/build_scripts/handle-built-files.py index e22600b4..c96de2ad 100755 --- a/tools/build_scripts/handle-built-files.py +++ b/tools/build_scripts/handle-built-files.py @@ -83,11 +83,8 @@ def build_from_m4(): '-I', include_dir, input_file, ] - output_file_obj = open(output_file, mode='w') - result = subprocess.run(cmd, stdout=output_file_obj) - output_file_obj.close() - - return result.returncode + with open(output_file, mode='w', encoding='utf-8') as output_file_obj: + return subprocess.run(cmd, stdout=output_file_obj).returncode # Invoked from meson.add_install_script(). def install_built_h_files(): |