Skip to content

Commit bdfde78

Browse files
committed
add command-line build tool
1 parent 07e5136 commit bdfde78

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

scripts/build_autograder.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python
2+
"""Create an uploadable Gradescope zip file from an autograder folder.
3+
4+
usage: build_autograder.py [-h] [--output OUTPUT] folder
5+
6+
Command line tool for building Python autograders.
7+
8+
positional arguments:
9+
folder Location of the folder containing autograder
10+
11+
optional arguments:
12+
-h, --help show this help message and exit
13+
--output OUTPUT, -o OUTPUT
14+
Output zip file location
15+
(default is to store the file in the autograder folder).
16+
"""
17+
18+
import argparse
19+
from pathlib import Path
20+
import jmu_gradescope_utils.build_utils as build_utils
21+
22+
23+
def main():
24+
25+
description = "Command line tool for building Python autograders."
26+
parser = argparse.ArgumentParser(description=description)
27+
parser.add_argument('folder',
28+
help='Location of the folder containing autograder')
29+
parser.add_argument('--output', '-o',
30+
help="Output zip file location (default is to store the file in the autograder folder).")
31+
32+
args = parser.parse_args()
33+
folder = Path(args.folder)
34+
if folder.exists():
35+
folder = folder.resolve()
36+
37+
if args.output is None:
38+
args.output = str(folder / ('autograder_' + str(folder.name) + ".zip"))
39+
40+
build_utils.build_zip(folder, args.output)
41+
42+
43+
if __name__ == "__main__":
44+
main()

0 commit comments

Comments
 (0)