Skip to content

Commit

Permalink
refactor: remove code needed for older py versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Nov 7, 2023
1 parent 822e788 commit 75729da
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions eodag/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,9 +1300,7 @@ def flatten_top_directories(nested_dir_root, common_subdirs_path=None):
if nested_dir_root != common_subdirs_path:
logger.debug(f"Flatten {common_subdirs_path} to {nested_dir_root}")
tmp_path = mkdtemp()
# need to delete tmp_path to prevent FileExistsError with copytree. Use dirs_exist_ok with py > 3.7
shutil.rmtree(tmp_path)
shutil.copytree(common_subdirs_path, tmp_path)
shutil.copytree(common_subdirs_path, tmp_path, dirs_exist_ok=True)
shutil.rmtree(nested_dir_root)
shutil.move(tmp_path, nested_dir_root)

Expand Down

0 comments on commit 75729da

Please sign in to comment.