[cairo-commit] 2 commits - boilerplate/make-cairo-boilerplate-constructors.py test/make-cairo-test-constructors.py version.py

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 24 15:14:47 UTC 2021


 boilerplate/make-cairo-boilerplate-constructors.py |    4 ++--
 test/make-cairo-test-constructors.py               |    4 ++--
 version.py                                         |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8d2f3f4afcbf55e58328fd8a4b1f4840737a7a4f
Merge: 784be5d85 9732f4e80
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Feb 24 15:14:45 2021 +0000

    Merge branch 'meson-force-utf8-file-encoding-in-scripts' into 'master'
    
    meson: use encoding=utf-8 when reading/writing files in helper script
    
    See merge request cairo/cairo!129

commit 9732f4e80f906fab85b97ae55ee44bfd3ee4945e
Author: Tim-Philipp Müller <tim at centricular.com>
Date:   Tue Feb 23 23:42:11 2021 +0000

    meson: use encoding=utf-8 when reading/writing files in helper script
    
    Fixes errors such as
    
    Traceback (most recent call last):
      File "C:\Users\...\cairo\test\make-cairo-test-constructors.py", line 19, in <module>
        for l in f.readlines():
      File "c:\python39\lib\encodings\cp1253.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 6694: character maps to <undefined>
    
    on non-English-language Windows locales/installations.

diff --git a/boilerplate/make-cairo-boilerplate-constructors.py b/boilerplate/make-cairo-boilerplate-constructors.py
index 8e02fa500..40198ed1a 100644
--- a/boilerplate/make-cairo-boilerplate-constructors.py
+++ b/boilerplate/make-cairo-boilerplate-constructors.py
@@ -16,12 +16,12 @@ if __name__=='__main__':
     match_boilerplate_name = re.compile(r'^CAIRO_BOILERPLATE.*\((.*),.*')
 
     for fname in args.input:
-        with open(fname, 'r') as f:
+        with open(fname, 'r', encoding='utf-8') as f:
             for l in f.readlines():
                 if match_boilerplate_line.match(l):
                     boilerplate_names.append(match_boilerplate_name.match(l).group(1))
 
-    with open(args.output, 'w') as f:
+    with open(args.output, 'w', encoding='utf-8') as f:
         f.write('/* WARNING: Autogenerated file - see %s! */\n\n' % sys.argv[0])
         f.write('#include "cairo-boilerplate-private.h"\n\n')
         f.write('void _cairo_boilerplate_register_all (void);\n\n')
diff --git a/test/make-cairo-test-constructors.py b/test/make-cairo-test-constructors.py
index 329763ccd..0e7d867bb 100644
--- a/test/make-cairo-test-constructors.py
+++ b/test/make-cairo-test-constructors.py
@@ -15,12 +15,12 @@ if __name__=='__main__':
     match_test_name = re.compile(r'^CAIRO_TEST.*\((.*),.*')
 
     for fname in args.input:
-        with open(fname, 'r') as f:
+        with open(fname, 'r', encoding='utf-8') as f:
             for l in f.readlines():
                 if match_test_line.match(l):
                     test_names.append(match_test_name.match(l).group(1))
 
-    with open(args.output, 'w') as f:
+    with open(args.output, 'w', encoding='utf-8') as f:
         f.write('/* WARNING: Autogenerated file - see %s! */\n\n' % sys.argv[0])
         f.write('#include "cairo-test-private.h"\n\n')
         f.write('void _cairo_test_runner_register_tests (void);\n\n')
diff --git a/version.py b/version.py
index 3b663abed..7e0ded0d7 100755
--- a/version.py
+++ b/version.py
@@ -14,7 +14,7 @@ if __name__ == '__main__':
     version_minor = None
     version_micro = None
 
-    f = open(os.path.join(srcroot, 'src', 'cairo-version.h'), 'r')
+    f = open(os.path.join(srcroot, 'src', 'cairo-version.h'), 'r', encoding='utf-8')
     for line in f:
         if line.startswith('#define CAIRO_VERSION_MAJOR '):
             version_major = line[28:].strip()


More information about the cairo-commit mailing list