mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 08:18:41 +00:00
style(judger,web): do not specify minor version to Python2
Python 2 is Python 2, Python 2.7 is also Python 2. So why Python 2.7 is Python 2.7? Make things tidy.
This commit is contained in:
parent
d030c261b2
commit
a642895253
@ -588,8 +588,8 @@ struct RunProgramConfig {
|
|||||||
string lang = conf_str(string(name) + "_language");
|
string lang = conf_str(string(name) + "_language");
|
||||||
type = "default";
|
type = "default";
|
||||||
string program_name = name;
|
string program_name = name;
|
||||||
if (lang == "Python2.7") {
|
if (lang == "Python2") {
|
||||||
type = "python2.7";
|
type = "python2";
|
||||||
} else if (lang == "Python3") {
|
} else if (lang == "Python3") {
|
||||||
type = "python3";
|
type = "python3";
|
||||||
} else if (lang == "Java8") {
|
} 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(),
|
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);
|
"/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(),
|
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);
|
("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) {
|
RunCompilerResult compile_python3(const string &name, const string &path = work_path) {
|
||||||
@ -1206,8 +1206,8 @@ RunCompilerResult compile(const char *name) {
|
|||||||
if (lang == "C++11") {
|
if (lang == "C++11") {
|
||||||
return compile_cpp11(name);
|
return compile_cpp11(name);
|
||||||
}
|
}
|
||||||
if (lang == "Python2.7") {
|
if (lang == "Python2") {
|
||||||
return compile_python2_7(name);
|
return compile_python2(name);
|
||||||
}
|
}
|
||||||
if (lang == "Python3") {
|
if (lang == "Python3") {
|
||||||
return compile_python3(name);
|
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);
|
"/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(),
|
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);
|
("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) {
|
RunCompilerResult compile_python3(const string &name, const string &path = work_path) {
|
||||||
|
@ -236,8 +236,8 @@ void parse_args(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (run_program_config.type == "python2.7") {
|
if (run_program_config.type == "python2") {
|
||||||
string pre[4] = {"/usr/bin/python2.7", "-E", "-s", "-B"};
|
string pre[4] = {"/usr/bin/python2", "-E", "-s", "-B"};
|
||||||
run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 4);
|
run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 4);
|
||||||
} else if (run_program_config.type == "python3") {
|
} else if (run_program_config.type == "python3") {
|
||||||
string pre[3] = {"/usr/bin/python3", "-I", "-B"};
|
string pre[3] = {"/usr/bin/python3", "-I", "-B"};
|
||||||
|
@ -325,7 +325,7 @@ void init_conf(const RunProgramConfig &config) {
|
|||||||
syscall_max_cnt[__NR_execve ] = -1;
|
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_tid_address] = 1;
|
||||||
syscall_max_cnt[__NR_set_robust_list] = 1;
|
syscall_max_cnt[__NR_set_robust_list] = 1;
|
||||||
syscall_max_cnt[__NR_futex ] = -1;
|
syscall_max_cnt[__NR_futex ] = -1;
|
||||||
|
@ -402,7 +402,7 @@ function echoSubmissionContent($submission, $requirement) {
|
|||||||
case 'C++11':
|
case 'C++11':
|
||||||
$sh_class = 'sh_cpp';
|
$sh_class = 'sh_cpp';
|
||||||
break;
|
break;
|
||||||
case 'Python2.7':
|
case 'Python2':
|
||||||
case 'Python3':
|
case 'Python3':
|
||||||
$sh_class = 'sh_python';
|
$sh_class = 'sh_python';
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
global $uojSupportedLanguages, $uojMainJudgerWorkPath;
|
global $uojSupportedLanguages, $uojMainJudgerWorkPath;
|
||||||
$uojSupportedLanguages = array('C++', 'Python2.7', 'Java8', 'C++11', 'Python3', 'Java11', 'C', 'Pascal');
|
$uojSupportedLanguages = array('C', 'C++', 'C++11', 'Java8', 'Java11', 'Pascal', 'Python2', 'Python3');
|
||||||
$uojMainJudgerWorkPath = "/home/local_main_judger/judge_client/uoj_judger";
|
$uojMainJudgerWorkPath = "/home/local_main_judger/judge_client/uoj_judger";
|
||||||
|
|
||||||
function authenticateJudger() {
|
function authenticateJudger() {
|
||||||
|
@ -604,7 +604,7 @@ function get_codemirror_mode(lang) {
|
|||||||
return 'text/x-c++src';
|
return 'text/x-c++src';
|
||||||
case 'C':
|
case 'C':
|
||||||
return 'text/x-csrc';
|
return 'text/x-csrc';
|
||||||
case 'Python2.7':
|
case 'Python2':
|
||||||
case 'Python3':
|
case 'Python3':
|
||||||
return 'text/x-python';
|
return 'text/x-python';
|
||||||
case 'Java8':
|
case 'Java8':
|
||||||
|
Loading…
Reference in New Issue
Block a user