8
8
import os
9
9
import json
10
10
import sys
11
+ import fnmatch
11
12
12
13
CONFIG_PATH = os .path .join (os .path .dirname (os .path .realpath (__file__ )), '..' , '..' , 'config' )
13
14
with open (os .path .join (CONFIG_PATH , 'submitty.json' )) as open_file :
@@ -33,6 +34,10 @@ def main():
33
34
semester = lichen_config_data ["semester" ]
34
35
course = lichen_config_data ["course" ]
35
36
gradeable = lichen_config_data ["gradeable" ]
37
+ expressions = None
38
+ if ("regex" in lichen_config_data ):
39
+ #this assumes regex is seperated by a ','
40
+ expressions = lichen_config_data ["regex" ].split (',' )
36
41
37
42
# ===========================================================================
38
43
# error checking
@@ -76,11 +81,17 @@ def main():
76
81
# loop over all files in all subdirectories
77
82
base_path = os .path .join (submission_dir ,user ,version )
78
83
for my_dir ,dirs ,my_files in os .walk (base_path ):
79
- for my_file in sorted (my_files ):
84
+ #Determine if regex should be used
85
+ files = sorted (my_files )
86
+ if (expressions != None ):
87
+ files_filtered = []
88
+ for e in expressions :
89
+ files_filtered .extend (fnmatch .filter (files , e .strip ()))
90
+ files = files_filtered
91
+ for my_file in files :
80
92
# skip the timestep
81
93
if my_file == ".submit.timestamp" :
82
94
continue
83
- # TODO: skip files that should be ignored
84
95
absolute_path = os .path .join (my_dir ,my_file )
85
96
relative_path = absolute_path [len (base_path ):]
86
97
# print a separator & filename
0 commit comments