-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathensure_clones.xsh
More file actions
61 lines (45 loc) · 1.47 KB
/
Copy pathensure_clones.xsh
File metadata and controls
61 lines (45 loc) · 1.47 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$XONSH_SUBPROC_CMD_RAISE_ERROR = True
from pathlib import Path
import yaml
import argparse
parser = argparse.ArgumentParser(description='Clone all of the needed source repos.')
parser.add_argument("--target", help="Path to clone into", type=str, default='~/source')
parser.add_argument("--caswell", help="If Caswell's sorting should be applied", action='store_true')
args = parser.parse_args()
# Handle git
bnl_orgs = {
"networkx",
"soft-matter",
"zarr-developers",
"pcdshub",
"nsls-ii",
"silx-kit",
"dask",
"bluesky",
"h5py",
"intake",
"scikit-hep",
"cgohlke",
"nikea",
"astropy",
}
def source_clone(target, org, repo, dest='other_source'):
target = target / dest / org
target.mkdir(parents=True, exist_ok=True)
cd @(target)
if not (target / repo).exists():
git clone --recursive @('https://github.com/' + '/'.join((org, repo)))
else:
cd @(target / repo)
# git remote update
target = Path(args.target).expanduser()
with open('used_repos.yaml') as fin:
required_repos = list(yaml.safe_load_all(fin))
print(set(b["user"] for b in required_repos))
for remote in required_repos:
if not args.caswell:
source_clone(target, remote['user'], remote['repo_name'], dest='')
elif remote["user"].lower() in bnl_orgs:
source_clone(target, remote['user'], remote['repo_name'], dest='bnl')
else:
source_clone(target, remote['user'] ,remote['repo_name'], dest='p')