diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-07-16 13:45:05 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-07-16 14:53:48 +0200 |
commit | 12ca841445cfa659349e6e76c8b8c53a988c0e7c (patch) | |
tree | 4e4506c94254b9c80b0301bde0ceb6ce30be7381 | |
parent | 225caae286976d3632d20459e57358205adced2e (diff) | |
download | glibmm-12ca841445cfa659349e6e76c8b8c53a988c0e7c.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(): |