From 637fb323d902f5d1238b9e5d76fbfed57143415c Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Fri, 24 Sep 2021 09:50:27 +0000 Subject: [PATCH] [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 --- runtime/tools/compiler_layering_check.py | 3 +-- runtime/tools/embedder_layering_check.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/runtime/tools/compiler_layering_check.py b/runtime/tools/compiler_layering_check.py index 06d73d98fd3..e8c955a0ee0 100755 --- a/runtime/tools/compiler_layering_check.py +++ b/runtime/tools/compiler_layering_check.py @@ -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 diff --git a/runtime/tools/embedder_layering_check.py b/runtime/tools/embedder_layering_check.py index 775040e5987..5e564d16cad 100644 --- a/runtime/tools/embedder_layering_check.py +++ b/runtime/tools/embedder_layering_check.py @@ -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: