Module: Mesa
Branch: main
Commit: e49925396627b62ddd9589afe9bce4ef0e750d20
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e49925396627b62ddd9589afe9bce4ef0e750d20

Author: Yonggang Luo <luoyongg...@gmail.com>
Date:   Tue Dec  5 14:24:10 2023 +0800

zink: Generate source file with utf-8 encoding from mako template

Make them generated in consistent way

Signed-off-by: Yonggang Luo <luoyongg...@gmail.com>
Acked-by: Eric Engestrom <e...@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26515>

---

 src/gallium/drivers/zink/zink_device_info.py | 4 ++--
 src/gallium/drivers/zink/zink_instance.py    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_device_info.py 
b/src/gallium/drivers/zink/zink_device_info.py
index 2c3cde855ca..c7d2aa4be4a 100644
--- a/src/gallium/drivers/zink/zink_device_info.py
+++ b/src/gallium/drivers/zink/zink_device_info.py
@@ -794,12 +794,12 @@ if __name__ == "__main__":
     lookup = TemplateLookup()
     lookup.put_string("helpers", include_template)
 
-    with open(header_path, "w") as header_file:
+    with open(header_path, "w", encoding='utf-8') as header_file:
         header = Template(header_code, 
lookup=lookup).render(extensions=extensions, versions=versions, 
registry=registry).strip()
         header = replace_code(header, replacement)
         print(header, file=header_file)
 
-    with open(impl_path, "w") as impl_file:
+    with open(impl_path, "w", encoding='utf-8') as impl_file:
         impl = Template(impl_code, 
lookup=lookup).render(extensions=extensions, versions=versions, 
registry=registry).strip()
         impl = replace_code(impl, replacement)
         print(impl, file=impl_file)
diff --git a/src/gallium/drivers/zink/zink_instance.py 
b/src/gallium/drivers/zink/zink_instance.py
index d65d502d3a6..0fbd14e5a58 100644
--- a/src/gallium/drivers/zink/zink_instance.py
+++ b/src/gallium/drivers/zink/zink_instance.py
@@ -386,12 +386,12 @@ if __name__ == "__main__":
         print("zink_instance.py: Found {} error(s) in total. 
Quitting.".format(error_count))
         exit(1)
 
-    with open(header_path, "w") as header_file:
+    with open(header_path, "w", encoding='utf-8') as header_file:
         header = Template(header_code).render(extensions=extensions, 
layers=layers, registry=registry).strip()
         header = replace_code(header, replacement)
         print(header, file=header_file)
 
-    with open(impl_path, "w") as impl_file:
+    with open(impl_path, "w", encoding='utf-8') as impl_file:
         impl = Template(impl_code).render(extensions=extensions, 
layers=layers, registry=registry).strip()
         impl = replace_code(impl, replacement)
         print(impl, file=impl_file)

Reply via email to