mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-05 11:30:20 +01:00
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.
This commit is contained in:
parent
d85738b39c
commit
9732f4e80f
3 changed files with 5 additions and 5 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue