mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-21 19:20:07 +00:00
Treat spir-v.xml as utf-8 (#5306)
* Treat spir-v.xml as utf-8 Treat the input file as utf-8, and configure the XML parser to use the utf-8 encoding. The Chromium build was breaking when trying to parse the XML file as ASCII. * Use Python io.open Try to fix the android-ndk-build flow. It seems to be using an old Python. For example, Python 2.6 builtin function open() did not support the 'encoding' keyword argument. But its io.open method did support it.
This commit is contained in:
parent
0f3bea06ef
commit
e751c7e7db
@ -15,8 +15,9 @@
|
||||
"""Generates the vendor tool table from the SPIR-V XML registry."""
|
||||
|
||||
import errno
|
||||
import io
|
||||
import os.path
|
||||
import xml.etree.ElementTree
|
||||
from xml.etree.ElementTree import XML, XMLParser, TreeBuilder
|
||||
|
||||
|
||||
def mkdir_p(directory):
|
||||
@ -78,8 +79,9 @@ def main():
|
||||
help='output file for SPIR-V generators table')
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.xml) as xml_in:
|
||||
registry = xml.etree.ElementTree.fromstring(xml_in.read())
|
||||
with io.open(args.xml, encoding='utf-8') as xml_in:
|
||||
parser = XMLParser(target=TreeBuilder(), encoding='utf-8')
|
||||
registry = XML(xml_in.read(), parser=parser)
|
||||
|
||||
mkdir_p(os.path.dirname(args.generator_output))
|
||||
with open(args.generator_output, 'w') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user