def compile_spj(self, spj_version, src, spj_compile_config):
spj_compile_config["src_name"] = spj_compile_config["src_name"].format(spj_version=spj_version)
spj_compile_config["exe_name"] = spj_compile_config["exe_name"].format(spj_version=spj_version)
spj_src_path = os.path.join(SPJ_SRC_DIR, spj_compile_config["src_name"])
# if spj source code not found, then write it into file
if not os.path.exists(spj_src_path):
with open(spj_src_path, "w") as f:
f.write(src.encode("utf-8"))
try:
Compiler().compile(compile_config=spj_compile_config,
src_path=spj_src_path,
output_dir=SPJ_EXE_DIR)
# turn common CompileError into SPJCompileError
except CompileError as e:
raise SPJCompileError(e.message)
return "success"
评论列表
文章目录