MCPcopy Create free account
hub / github.com/apache/fory / sync_files

Function sync_files

ci/validate_fory_site_sync.py:73–88  ·  view source on GitHub ↗
(
    fory_root: pathlib.Path, site_root: pathlib.Path, sync_file: pathlib.Path
)

Source from the content-addressed store, hash-verified

71
72
73def 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
91def rewrite_versions_block(text: str) -> str:

Callers 1

mainFunction · 0.85

Calls 2

parse_sync_mappingsFunction · 0.85
to_workspace_pathFunction · 0.85

Tested by

no test coverage detected