diff --git a/judger/uoj_judger/include/uoj_judger.h b/judger/uoj_judger/include/uoj_judger.h index 60edf83..a36b7f7 100644 --- a/judger/uoj_judger/include/uoj_judger.h +++ b/judger/uoj_judger/include/uoj_judger.h @@ -588,8 +588,8 @@ struct RunProgramConfig { string lang = conf_str(string(name) + "_language"); type = "default"; string program_name = name; - if (lang == "Python2.7") { - type = "python2.7"; + if (lang == "Python2") { + type = "python2"; } else if (lang == "Python3") { type = "python3"; } else if (lang == "Java8") { @@ -1150,9 +1150,9 @@ RunCompilerResult compile_cpp11(const string &name, const string &path = work_pa return run_compiler(path.c_str(), "/usr/bin/g++", "-o", name.c_str(), "-x", "c++", (name + ".code").c_str(), "-lm", "-O2", "-DONLINE_JUDGE", "-std=c++11", NULL); } -RunCompilerResult compile_python2_7(const string &name, const string &path = work_path) { +RunCompilerResult compile_python2(const string &name, const string &path = work_path) { return run_compiler(path.c_str(), - "/usr/bin/python2.7", "-E", "-s", "-B", "-O", "-c", + "/usr/bin/python2", "-E", "-s", "-B", "-O", "-c", ("import py_compile\nimport sys\ntry:\n py_compile.compile('" + name + ".code'" + ", '" + name + "', doraise=True)\n sys.exit(0)\nexcept Exception as e:\n print e\n sys.exit(1)").c_str(), NULL); } RunCompilerResult compile_python3(const string &name, const string &path = work_path) { @@ -1206,8 +1206,8 @@ RunCompilerResult compile(const char *name) { if (lang == "C++11") { return compile_cpp11(name); } - if (lang == "Python2.7") { - return compile_python2_7(name); + if (lang == "Python2") { + return compile_python2(name); } if (lang == "Python3") { return compile_python3(name); @@ -1248,9 +1248,9 @@ RunCompilerResult compile_cpp11_with_implementer(const string &name, const strin "/usr/bin/g++", "-o", name.c_str(), "implementer.cpp", "-x", "c++", (name + ".code").c_str(), "-lm", "-O2", "-DONLINE_JUDGE", "-std=c++11", NULL); } /* -RunCompilerResult compile_python2_7(const string &name, const string &path = work_path) { +RunCompilerResult compile_python2(const string &name, const string &path = work_path) { return run_compiler(path.c_str(), - "/usr/bin/python2.7", "-E", "-s", "-B", "-O", "-c", + "/usr/bin/python2", "-E", "-s", "-B", "-O", "-c", ("import py_compile\nimport sys\ntry:\n py_compile.compile('" + name + ".code'" + ", '" + name + "', doraise=True)\n sys.exit(0)\nexcept Exception as e:\n print e\n sys.exit(1)").c_str(), NULL); } RunCompilerResult compile_python3(const string &name, const string &path = work_path) { diff --git a/judger/uoj_judger/run/run_program.cpp b/judger/uoj_judger/run/run_program.cpp index 878357d..f7ebea2 100644 --- a/judger/uoj_judger/run/run_program.cpp +++ b/judger/uoj_judger/run/run_program.cpp @@ -236,8 +236,8 @@ void parse_args(int argc, char **argv) { } } - if (run_program_config.type == "python2.7") { - string pre[4] = {"/usr/bin/python2.7", "-E", "-s", "-B"}; + if (run_program_config.type == "python2") { + string pre[4] = {"/usr/bin/python2", "-E", "-s", "-B"}; run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 4); } else if (run_program_config.type == "python3") { string pre[3] = {"/usr/bin/python3", "-I", "-B"}; diff --git a/judger/uoj_judger/run/run_program_conf.h b/judger/uoj_judger/run/run_program_conf.h index a584789..6988e1e 100644 --- a/judger/uoj_judger/run/run_program_conf.h +++ b/judger/uoj_judger/run/run_program_conf.h @@ -325,7 +325,7 @@ void init_conf(const RunProgramConfig &config) { syscall_max_cnt[__NR_execve ] = -1; } - if (config.type == "python2.7") { + if (config.type == "python2") { syscall_max_cnt[__NR_set_tid_address] = 1; syscall_max_cnt[__NR_set_robust_list] = 1; syscall_max_cnt[__NR_futex ] = -1; diff --git a/web/app/libs/uoj-html-lib.php b/web/app/libs/uoj-html-lib.php index 0c2f331..4d2de40 100644 --- a/web/app/libs/uoj-html-lib.php +++ b/web/app/libs/uoj-html-lib.php @@ -402,7 +402,7 @@ function echoSubmissionContent($submission, $requirement) { case 'C++11': $sh_class = 'sh_cpp'; break; - case 'Python2.7': + case 'Python2': case 'Python3': $sh_class = 'sh_python'; break; diff --git a/web/app/libs/uoj-judger-lib.php b/web/app/libs/uoj-judger-lib.php index 85b12d0..0c29c3c 100644 --- a/web/app/libs/uoj-judger-lib.php +++ b/web/app/libs/uoj-judger-lib.php @@ -1,6 +1,6 @@