From c6204343a841bca62e3646cb1620f5b176b285d4 Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Fri, 19 Jan 2024 16:08:34 +0100 Subject: [PATCH] fix(pre-commit): Fixed README.md encoding on Windows Windows will open the file using 'cp1252' encoding, which may result in 'UnicodeDecodeError' for unsupported symbols. --- tools/ci/check_build_test_rules.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/ci/check_build_test_rules.py b/tools/ci/check_build_test_rules.py index e70fb0e324..e3079a3a40 100755 --- a/tools/ci/check_build_test_rules.py +++ b/tools/ci/check_build_test_rules.py @@ -1,8 +1,6 @@ #!/usr/bin/env python - -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 - import argparse import inspect import os @@ -10,10 +8,14 @@ import re import sys from io import StringIO from pathlib import Path -from typing import Dict, List, Optional, Tuple +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple import yaml -from idf_ci_utils import IDF_PATH, get_all_manifest_files +from idf_ci_utils import get_all_manifest_files +from idf_ci_utils import IDF_PATH YES = u'\u2713' NO = u'\u2717' @@ -94,7 +96,7 @@ def check_readme( if not _readme_path: return None, SUPPORTED_TARGETS - with open(_readme_path) as _fr: + with open(_readme_path, encoding='utf8') as _fr: _readme_str = _fr.read() support_string = SUPPORTED_TARGETS_TABLE_REGEX.findall(_readme_str)