1414from sinol_make .helpers .parsers import add_compilation_arguments
1515from sinol_make .interfaces .BaseCommand import BaseCommand
1616from sinol_make .interfaces .Errors import CompilationError , CheckerOutputException , UnknownContestType
17- from sinol_make .helpers import compile , compiler , package_util , printer
17+ from sinol_make .helpers import compile , compiler , package_util , printer , paths
1818from sinol_make .structs .status_structs import Status
1919import sinol_make .util as util
2020import yaml , os , collections , sys , re , math , dictdiffer
@@ -339,8 +339,8 @@ def get_groups(self, tests):
339339
340340
341341 def compile_solutions (self , solutions ):
342- os .makedirs (self . COMPILATION_DIR , exist_ok = True )
343- os .makedirs (self . EXECUTABLES_DIR , exist_ok = True )
342+ os .makedirs (paths . get_compilation_log_path () , exist_ok = True )
343+ os .makedirs (paths . get_executables_path () , exist_ok = True )
344344 print ("Compiling %d solutions..." % len (solutions ))
345345 args = [(solution , True ) for solution in solutions ]
346346 with mp .Pool (self .cpus ) as pool :
@@ -349,10 +349,9 @@ def compile_solutions(self, solutions):
349349
350350
351351 def compile (self , solution , use_extras = False ):
352- compile_log_file = os .path .join (
353- self .COMPILATION_DIR , "%s.compile_log" % package_util .get_file_name (solution ))
352+ compile_log_file = paths .get_compilation_log_path ("%s.compile_log" % package_util .get_file_name (solution ))
354353 source_file = os .path .join (os .getcwd (), "prog" , self .get_solution_from_exe (solution ))
355- output = os . path . join ( self . EXECUTABLES_DIR , package_util .get_executable (solution ))
354+ output = paths . get_executables_path ( package_util .get_executable (solution ))
356355
357356 extra_compilation_args = []
358357 extra_compilation_files = []
@@ -581,7 +580,7 @@ def run_solution(self, data_for_execution: ExecutionData):
581580 """
582581
583582 (name , executable , test , time_limit , memory_limit , timetool_path ) = data_for_execution
584- file_no_ext = os . path . join ( self . EXECUTIONS_DIR , name , package_util .extract_test_id (test ))
583+ file_no_ext = paths . get_executions_path ( name , package_util .extract_test_id (test ))
585584 output_file = file_no_ext + ".out"
586585 result_file = file_no_ext + ".res"
587586 hard_time_limit_in_s = math .ceil (2 * time_limit / 1000.0 )
@@ -620,7 +619,7 @@ def run_solutions(self, compiled_commands, names, solutions):
620619 executions .append ((name , executable , test , package_util .get_time_limit (test , self .config , lang , self .args ),
621620 package_util .get_memory_limit (test , self .config , lang , self .args ), self .timetool_path ))
622621 all_results [name ][self .get_group (test )][test ] = ExecutionResult (Status .PENDING )
623- os .makedirs (os . path . join ( self . EXECUTIONS_DIR , name ), exist_ok = True )
622+ os .makedirs (paths . get_executions_path ( name ), exist_ok = True )
624623 else :
625624 for test in self .tests :
626625 all_results [name ][self .get_group (test )][test ] = ExecutionResult (Status .CE )
@@ -685,9 +684,8 @@ def compile_and_run(self, solutions):
685684 for i in range (len (solutions )):
686685 if not compilation_results [i ]:
687686 self .failed_compilations .append (solutions [i ])
688- os .makedirs (self .EXECUTIONS_DIR , exist_ok = True )
689- executables = [os .path .join (self .EXECUTABLES_DIR , package_util .get_executable (solution ))
690- for solution in solutions ]
687+ os .makedirs (paths .get_executions_path (), exist_ok = True )
688+ executables = [paths .get_executables_path (package_util .get_executable (solution )) for solution in solutions ]
691689 compiled_commands = zip (solutions , executables , compilation_results )
692690 names = solutions
693691 return self .run_solutions (compiled_commands , names , solutions )
@@ -966,12 +964,7 @@ def set_group_result(solution, group, result):
966964
967965 def set_constants (self ):
968966 self .ID = package_util .get_task_id ()
969- self .TMP_DIR = os .path .join (os .getcwd (), "cache" )
970- self .COMPILATION_DIR = os .path .join (self .TMP_DIR , "compilation" )
971- self .EXECUTIONS_DIR = os .path .join (self .TMP_DIR , "executions" )
972- self .EXECUTABLES_DIR = os .path .join (self .TMP_DIR , "executables" )
973967 self .SOURCE_EXTENSIONS = ['.c' , '.cpp' , '.py' , '.java' ]
974- self .PROGRAMS_IN_ROW = 8
975968 self .SOLUTIONS_RE = re .compile (r"^%s[bs]?[0-9]*\.(cpp|cc|java|py|pas)$" % self .ID )
976969
977970
@@ -1138,7 +1131,7 @@ def run(self, args):
11381131 print (util .info ("Checker found: %s" % os .path .basename (checker [0 ])))
11391132 self .checker = checker [0 ]
11401133 checker_basename = os .path .basename (self .checker )
1141- self .checker_executable = os . path . join ( self . EXECUTABLES_DIR , checker_basename + ".e" )
1134+ self .checker_executable = paths . get_executables_path ( checker_basename + ".e" )
11421135
11431136 checker_compilation = self .compile_solutions ([self .checker ])
11441137 if not checker_compilation [0 ]:
0 commit comments