[glibmm] handle-built-files.py: Specify file encoding on generated files



commit eb3f7215e05a46d02b878ef4a6ba4bef85a1ef6f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Jul 16 13:45:05 2021 +0200

    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.

 tools/build_scripts/handle-built-files.py | 7 ++-----
 1 file 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():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]