diff --git a/judge/utils/problem_data.py b/judge/utils/problem_data.py index 0ebc8d0..17b0065 100644 --- a/judge/utils/problem_data.py +++ b/judge/utils/problem_data.py @@ -13,9 +13,6 @@ from django.urls import reverse from django.utils.translation import gettext as _ from django.core.cache import cache -VALIDATOR_TEMPLATE_PATH = "validator_template/template.py" - - if os.altsep: def split_path_first( @@ -75,30 +72,6 @@ class ProblemDataCompiler(object): raise ProblemDataError(_("Empty batches not allowed.")) cases.append(batch) - def make_checker_for_validator(case): - checker_name = "cppvalidator.py" - validator_path = split_path_first(case.custom_validator.name) - - if len(validator_path) != 2: - raise ProblemDataError( - _("How did you corrupt the custom checker path?") - ) - - checker = os.path.join( - settings.DMOJ_PROBLEM_DATA_ROOT, validator_path[0], checker_name - ) - - validator_name = validator_path[1] - shutil.copy(VALIDATOR_TEMPLATE_PATH, checker) - - # replace {{filecpp}} and {{problemid}} in checker file - filedata = open(checker, "r").read() - filedata = filedata.replace("{{filecpp}}", "'%s'" % validator_name) - filedata = filedata.replace("{{problemid}}", "'%s'" % validator_path[0]) - open(checker, "w").write(filedata) - - return checker_name - def make_checker(case): if case.checker == "custom": custom_checker_path = split_path_first(case.custom_checker.name) @@ -109,7 +82,19 @@ class ProblemDataCompiler(object): return custom_checker_path[1] if case.checker == "customval": - return make_checker_for_validator(case) + custom_checker_path = split_path_first(case.custom_validator.name) + if len(custom_checker_path) != 2: + raise ProblemDataError( + _("How did you corrupt the custom checker path?") + ) + return { + "name": "bridged", + "args": { + "files": custom_checker_path[1], + "lang": "CPP14", + "type": "lqdoj", + }, + } if case.checker_args: return {