-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_local_containers.py
42 lines (34 loc) · 1 KB
/
build_local_containers.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import shutil
import sys
import pathlib
import subprocess
import glob
from ViroConstrictor.userprofile import ReadConfig
userconf = ReadConfig(pathlib.Path("~/.ViroConstrictor_defaultprofile.ini").expanduser())
containerpath = None
try:
containerpath = userconf["REPRODUCTION"]["container_cache_path"]
except KeyError as e:
raise KeyError(
"The container_cache_path option is missing from the REPRODUCTION section of your configuration file."
) from e
if not os.path.exists(containerpath):
os.makedirs(containerpath)
subprocess.run(
"python ./containers/build_containers.py",
shell=True,
check=True,
)
subprocess.run(
"python containers/convert_artifact_containers_for_apptainer.py",
shell=True,
check=True,
)
for file in glob.glob("./containers/*.sif"):
print(file)
shutil.move(file, containerpath) if containerpath else None
for file in glob.glob("./containers/*.tar"):
print(file)
os.remove(file)
os.remove("./containers/builtcontainers.json")