From 8dbce238fa6755cc2dc2033e0d6e77be4ed07091 Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Fri, 11 Oct 2024 10:54:12 +0200 Subject: [PATCH] Fix backwards compatibility with Python 3.9 --- tools/deployment-cli-tools/ch_cli_tools/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/deployment-cli-tools/ch_cli_tools/utils.py b/tools/deployment-cli-tools/ch_cli_tools/utils.py index 3f3f5659..53f36953 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/utils.py +++ b/tools/deployment-cli-tools/ch_cli_tools/utils.py @@ -217,8 +217,8 @@ def copymergedir(source_root_directory: pathlib.Path, destination_root_directory """ logging.info(f'Copying directory {source_root_directory} to {destination_root_directory}') - for source_directory, _, files in source_root_directory.walk(): - + for source_directory, _, files in os.walk(source_root_directory): # source_root_directory.walk() from Python 3.12 + source_directory = pathlib.Path(source_directory) destination_directory = destination_root_directory / source_directory.relative_to(source_root_directory) destination_directory.mkdir(parents=True, exist_ok=True) @@ -272,8 +272,8 @@ def merge_configuration_directories(source: Union[str, pathlib.Path], destinatio shutil.copytree(source_path, destination_path, ignore=shutil.ignore_patterns(*EXCLUDE_PATHS)) return - for source_directory, _, files in source_path.walk(): - _merge_configuration_directory(source_path, destination_path, source_directory, files) + for source_directory, _, files in os.walk(source_path): # source_path.walk() from Python 3.12 + _merge_configuration_directory(source_path, destination_path, pathlib.Path(source_directory), files) def _merge_configuration_directory(