-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_zeroflow.py
27 lines (22 loc) · 1002 Bytes
/
update_zeroflow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from pathlib import Path
import argparse
import shutil
# Get optional path to the ZeroFlow public repo.
parser = argparse.ArgumentParser()
parser.add_argument("zeroflow_repo", type=Path)
args = parser.parse_args()
assert args.zeroflow_repo.exists(), f"{args.zeroflow_repo} does not exist"
current_path = Path().resolve()
# Use the entries in the ZeroFlow repo to grab the files / folders we need from this repo.
for zeroflow_path in args.zeroflow_repo.glob("*"):
# Copy from this repo to the ZeroFlow repo.
if zeroflow_path.name == ".git":
print(f"Skipping {zeroflow_path}")
continue
if zeroflow_path.is_dir():
print(f"Copying directory {zeroflow_path.name} to {zeroflow_path}")
shutil.rmtree(zeroflow_path, ignore_errors=True)
shutil.copytree(current_path / zeroflow_path.name, zeroflow_path)
else:
print(f"Copying file {zeroflow_path.name} to {zeroflow_path}")
shutil.copy(current_path / zeroflow_path.name, zeroflow_path)