unicorn/qemu/scripts
Philippe Mathieu-Daudé 296c32a8da decodetree: Open files with encoding='utf-8'
When decodetree.py was added in commit 568ae7efae7, QEMU was
using Python 2 which happily reads UTF-8 files in text mode.
Python 3 requires either UTF-8 locale or an explicit encoding
passed to open(). Now that Python 3 is required, explicit
UTF-8 encoding for decodetree source files.

To avoid further problems with the user locale, also explicit
UTF-8 encoding for the generated C files.

Explicit both input/output are plain text by using the 't' mode.

This fixes:

$ /usr/bin/python3 scripts/decodetree.py test.decode
Traceback (most recent call last):
File "scripts/decodetree.py", line 1397, in <module>
main()
File "scripts/decodetree.py", line 1308, in main
parse_file(f, toppat)
File "scripts/decodetree.py", line 994, in parse_file
for line in f:
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 80:
ordinal not in range(128)

Backports 4cacecaaa2bbf8af0967bd3eee43297fada475a9
2021-03-04 13:34:08 -05:00
..
qapi qapi: Prepare for system modules other than 'builtin' 2019-02-21 09:58:54 -05:00
create_config Revert "Makefile: Rename TARGET_DIRS to TARGET_LIST" 2018-07-05 17:40:24 -04:00
decodetree.py decodetree: Open files with encoding='utf-8' 2021-03-04 13:34:08 -05:00
make_device_config.sh fix file perms 2015-08-28 21:05:38 -07:00
ordereddict.py import 2015-08-21 15:04:50 +08:00
qapi-gen.py qapi: Lift error reporting from QAPISchema.__init__() to callers 2018-03-09 08:55:45 -05:00