-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud_init.py
More file actions
23 lines (21 loc) · 831 Bytes
/
Copy pathcloud_init.py
File metadata and controls
23 lines (21 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import subprocess
import sys
_CLOUD_DIR = "/mount/src"
if os.path.isdir(_CLOUD_DIR):
_REPOS = {
"MESONH_CODE_DIR": ("mesonh-code", "https://src.koda.cnrs.fr/mesonh/mesonh-code.git"),
"MESONH_DOC_DIR": ("mesonh-doc", "https://github.com/JorisPianezze/mesonh_doc.git"),
}
for _env_var, (_dirname, _repo_url) in _REPOS.items():
if not os.environ.get(_env_var):
_dest = os.path.join(_CLOUD_DIR, _dirname)
if not os.path.isdir(_dest):
try:
subprocess.run(
["git", "clone", "--depth", "1", _repo_url, _dest],
check=True, capture_output=True, timeout=120,
)
except Exception:
continue
os.environ[_env_var] = _dest