[vm] Use UTF-8 to read files in *_layering_check.py

Some files in runtime/ are UTF-8 encoded, e.g.:
runtime/vm/unicode_test.cc

Change-Id: Ie71fd46fb66fe793742dbf8a6645b8402956ab77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Alexander Thomas 2021-09-24 09:50:27 +00:00
parent 08ee5989b4
commit 637fb323d9
2 changed files with 2 additions and 4 deletions

View file

@ -10,7 +10,6 @@
# Currently it only checks that core runtime headers RUNTIME_LAYER_HEADERS
# are not included into any sources listed in SHOULD_NOT_DEPEND_ON_RUNTIME.
import glob
import os
import re
import sys
@ -107,7 +106,7 @@ class LayeringChecker(object):
def ExtractIncludes(self, file):
"""Extract the list of includes from the given file."""
deps = set()
with open(os.path.join(self.root, file)) as file:
with open(os.path.join(self.root, file), encoding='utf-8') as file:
for line in file:
if line.startswith('namespace dart {'):
break

View file

@ -7,7 +7,6 @@
# Simple tool for verifying that sources from the standalone embedder do not
# directly include sources from the VM or vice versa.
import glob
import os
import re
import sys
@ -28,7 +27,7 @@ EXTRA_TEST_FILES = [
def CheckFile(sdk_root, path):
includes = set()
with open(os.path.join(sdk_root, path)) as file:
with open(os.path.join(sdk_root, path), encoding='utf-8') as file:
for line in file:
m = INCLUDE_DIRECTIVE_RE.match(line)
if m is not None: