-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit.py
50 lines (37 loc) · 1.12 KB
/
submit.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
43
44
45
46
47
48
49
50
#!/usr/bin/python3
import sys
from pathlib import Path
from JenkinsJob import JenkinsJob
from JenkinsJob import authenticate
from JenkinsJob import queryAction
"""
Tutorial submission script
"""
if __name__ == "__main__":
def get_target():
valid_targets = ["preliminary", "final"]
valid_targets_str = '/'.join(valid_targets)
while True:
sys.stdout.write(
"Select submission target? [" + valid_targets_str + "] ")
resp = input()
if (resp in valid_targets):
return resp
sys.stdout.write("Invalid target! Try again.\n")
target = get_target()
choices = ["build", "check"]
action = queryAction(choices)
auth = authenticate()
here = Path(__file__).parent.absolute()
def getAbsPath(subdir, files):
prefix_path = here / Path(subdir)
return [prefix_path / Path(f) for f in files]
job = JenkinsJob(
name=f"04-snake-{target}-{auth[0]}",
files=['snake.asm'],
auth=auth
)
if action == "build":
job.build(zipfiles=False)
else:
job.getLogs()