mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 08:58:42 +00:00
fix(judger): python
This commit is contained in:
parent
7a7d46e057
commit
8ce32618b6
@ -3,7 +3,7 @@
|
|||||||
getAptPackage(){
|
getAptPackage(){
|
||||||
printf "\n\n==> Getting environment packages\n"
|
printf "\n\n==> Getting environment packages\n"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update && apt-get install -y vim ntp zip unzip curl wget build-essential fp-compiler python python3 python3-requests openjdk-8-jdk openjdk-11-jdk
|
apt-get update && apt-get install -y vim ntp zip unzip curl wget build-essential fp-compiler python2.7 python3.8 python3-requests openjdk-8-jdk openjdk-11-jdk
|
||||||
}
|
}
|
||||||
|
|
||||||
setJudgeConf(){
|
setJudgeConf(){
|
||||||
@ -24,7 +24,7 @@ cd /opt/uoj_judger && chmod +x judge_client
|
|||||||
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
|
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
|
||||||
#define UOJ_WORK_PATH "/opt/uoj_judger/uoj_judger"
|
#define UOJ_WORK_PATH "/opt/uoj_judger/uoj_judger"
|
||||||
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
|
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
|
||||||
#define UOJ_JUDGER_PYTHON3_VERSION "3.6"
|
#define UOJ_JUDGER_PYTHON3_VERSION "3.8"
|
||||||
#define UOJ_JUDGER_FPC_VERSION "3.0.4"
|
#define UOJ_JUDGER_FPC_VERSION "3.0.4"
|
||||||
UOJEOF
|
UOJEOF
|
||||||
cd uoj_judger && make -j$(($(nproc) + 1))
|
cd uoj_judger && make -j$(($(nproc) + 1))
|
||||||
|
@ -1152,12 +1152,12 @@ RunCompilerResult compile_cpp11(const string &name, const string &path = work_pa
|
|||||||
}
|
}
|
||||||
RunCompilerResult compile_python2(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", "-E", "-s", "-B", "-O", "-c",
|
"/usr/bin/python2.7", "-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) {
|
||||||
return run_compiler(path.c_str(),
|
return run_compiler(path.c_str(),
|
||||||
"/usr/bin/python3", "-I", "-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);
|
"/usr/bin/python3.8", "-I", "-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_java8(const string &name, const string &path = work_path) {
|
RunCompilerResult compile_java8(const string &name, const string &path = work_path) {
|
||||||
RunCompilerResult ret = prepare_java_source(name, path);
|
RunCompilerResult ret = prepare_java_source(name, path);
|
||||||
@ -1250,12 +1250,12 @@ RunCompilerResult compile_cpp11_with_implementer(const string &name, const strin
|
|||||||
/*
|
/*
|
||||||
RunCompilerResult compile_python2(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", "-E", "-s", "-B", "-O", "-c",
|
"/usr/bin/python2.7", "-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) {
|
||||||
return run_compiler(path.c_str(),
|
return run_compiler(path.c_str(),
|
||||||
"/usr/bin/python3", "-I", "-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);
|
"/usr/bin/python3.8", "-I", "-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_with_implementer(const char *name) {
|
RunCompilerResult compile_with_implementer(const char *name) {
|
||||||
|
@ -237,10 +237,10 @@ void parse_args(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (run_program_config.type == "python2") {
|
if (run_program_config.type == "python2") {
|
||||||
string pre[4] = {"/usr/bin/python2", "-E", "-s", "-B"};
|
string pre[4] = {"/usr/bin/python2.7", "-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.8", "-I", "-B"};
|
||||||
run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 3);
|
run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 3);
|
||||||
} else if (run_program_config.type == "java8") {
|
} else if (run_program_config.type == "java8") {
|
||||||
string pre[3] = {"/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-Xmx1024m", "-Xss1024m"};
|
string pre[3] = {"/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-Xmx1024m", "-Xss1024m"};
|
||||||
|
Loading…
Reference in New Issue
Block a user