(
fory_root: pathlib.Path, site_root: pathlib.Path, sync_file: pathlib.Path
)
| 71 | |
| 72 | |
| 73 | def sync_files( |
| 74 | fory_root: pathlib.Path, site_root: pathlib.Path, sync_file: pathlib.Path |
| 75 | ) -> None: |
| 76 | for source, dest in parse_sync_mappings(sync_file): |
| 77 | src_path = to_workspace_path(fory_root, source) |
| 78 | dst_path = to_workspace_path(site_root, dest) |
| 79 | if not src_path.exists(): |
| 80 | raise FileNotFoundError(f"source path does not exist: {src_path}") |
| 81 | if src_path.is_dir(): |
| 82 | if dst_path.exists(): |
| 83 | shutil.rmtree(dst_path) |
| 84 | shutil.copytree(src_path, dst_path) |
| 85 | else: |
| 86 | dst_path.parent.mkdir(parents=True, exist_ok=True) |
| 87 | shutil.copy2(src_path, dst_path) |
| 88 | print(f"synced {source} -> {dest}") |
| 89 | |
| 90 | |
| 91 | def rewrite_versions_block(text: str) -> str: |
no test coverage detected