Skip to content

Commit

Permalink
Fix backwards compatibility with Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Oct 11, 2024
1 parent c362ece commit 8dbce23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/deployment-cli-tools/ch_cli_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 8dbce23

Please sign in to comment.