(source_dir: Path, dest_dir: Path)
| 211 | return tmp_agent_root |
| 212 | |
| 213 | def copy_dir_contents(source_dir: Path, dest_dir: Path) -> None: |
| 214 | dest_dir.mkdir(parents=True, exist_ok=True) |
| 215 | for source_path in source_dir.iterdir(): |
| 216 | if source_path.name == "tmp": |
| 217 | continue |
| 218 | |
| 219 | dest_path = dest_dir / source_path.name |
| 220 | if source_path.is_dir(): |
| 221 | if dest_path.exists() and dest_path.is_file(): |
| 222 | dest_path.unlink() |
| 223 | shutil.copytree(source_path, dest_path, dirs_exist_ok=True) |
| 224 | elif source_path.is_file(): |
| 225 | if dest_path.exists() and dest_path.is_dir(): |
| 226 | shutil.rmtree(dest_path) |
| 227 | shutil.copy2(source_path, dest_path) |
| 228 | |
| 229 | def cleanup_tmp(app_name: str) -> bool: |
| 230 | try: |
no test coverage detected