Merge branch 'fix/failing_create_readonly_test_on_win_v5.4' into 'release/v5.4'

fix(tools): fixed failing Win CI (tests read_only) (v5.4)

See merge request espressif/esp-idf!36122
This commit is contained in:
Roland Dobai
2025-01-06 15:40:32 +08:00

View File

@@ -1,9 +1,9 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import os import os
import re import re
import sys import sys
from shutil import copy from shutil import copyfile
from shutil import copytree from shutil import copytree
from typing import Dict from typing import Dict
@@ -42,7 +42,8 @@ def create_project(target_path: str, name: str) -> None:
copytree( copytree(
os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_project'), os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_project'),
target_path, target_path,
copy_function=copy, # 'copyfile' ensures only data are copied, without any metadata (file permissions)
copy_function=copyfile,
dirs_exist_ok=True, dirs_exist_ok=True,
) )
main_folder = os.path.join(target_path, 'main') main_folder = os.path.join(target_path, 'main')
@@ -55,7 +56,8 @@ def create_component(target_path: str, name: str) -> None:
copytree( copytree(
os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_component'), os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_component'),
target_path, target_path,
copy_function=copy, # 'copyfile' ensures only data are copied, without any metadata (file permissions)
copy_function=copyfile,
dirs_exist_ok=True, dirs_exist_ok=True,
) )
os.rename(os.path.join(target_path, 'main.c'), os.path.join(target_path, '.'.join((name, 'c')))) os.rename(os.path.join(target_path, 'main.c'), os.path.join(target_path, '.'.join((name, 'c'))))