MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / init_report

Method init_report

mod/project/python/pyenv_tool.py:1086–1105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1084 return "保存记录失败:{}".format(e)
1085
1086 def init_report(self):
1087 if os.path.exists(self.REPORT_FILE):
1088 r = self.generate_report()
1089 # public.print_log("环境记录已存在,更新记录")
1090 # public.print_log(r)
1091 self.update_report(*r["environments"])
1092 else:
1093 with open(self.REPORT_FILE, "w") as fs:
1094 fs.write(json.dumps(self.generate_report(), indent=4))
1095 em = EnvironmentManager()
1096 all_py_project = public.M("sites").where("project_type=?", ("Python",)).field('id,project_config').select()
1097 for project in all_py_project:
1098 project_config: dict = json.loads(project['project_config'])
1099 if "python_bin" in project_config:
1100 continue
1101 p = em.get_env_py_path(project_config.get("vpath"))
1102 if p:
1103 project_config["python_bin"] = p.bin_path
1104
1105 public.M("sites").where("id=?", (project['id'],)).update({"project_config": json.dumps(project_config)})
1106
1107
1108

Callers 2

pyenv_tool.pyFile · 0.80

Calls 15

generate_reportMethod · 0.95
update_reportMethod · 0.95
get_env_py_pathMethod · 0.95
openFunction · 0.85
EnvironmentManagerClass · 0.85
existsMethod · 0.45
writeMethod · 0.45
dumpsMethod · 0.45
selectMethod · 0.45
fieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45

Tested by

no test coverage detected