-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_bundle.py
More file actions
39 lines (34 loc) · 1.24 KB
/
Copy pathcreate_bundle.py
File metadata and controls
39 lines (34 loc) · 1.24 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
import zipfile
from pathlib import Path
ROOT_DIR = Path(__file__).parent
PAGES_DIR = ROOT_DIR / "pages"
INGESTION_DIR = ROOT_DIR / "ingestion_program"
SCORING_DIR = ROOT_DIR / "scoring_program"
PHASE_DATA = ROOT_DIR / "dev_phase"
STARTING_KIT_DIR = ROOT_DIR / "starting_kit"
BUNDLE_FILES = [
ROOT_DIR / "competition.yaml",
ROOT_DIR / "logo.png",
ROOT_DIR / "solution/submission.py",
]
if __name__ == "__main__":
print(ROOT_DIR)
with zipfile.ZipFile("bundle.zip", mode="w") as bundle:
for f in BUNDLE_FILES:
f = f.relative_to(ROOT_DIR)
print(f)
bundle.write(f)
for dirpath in [INGESTION_DIR, SCORING_DIR, PAGES_DIR, PHASE_DATA, STARTING_KIT_DIR]:
assert dirpath.exists(), (
f"{dirpath} does not exist while it should. Make sure you "
"followed all the instructions in the README before "
"creating the bundle."
)
for f in dirpath.rglob("*"):
if not f.is_file():
continue
if f.name.startswith(".") or f.name.endswith(".pyc"):
continue
f = f.relative_to(ROOT_DIR)
print(f)
bundle.write(f)