(self)
| 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 |
no test coverage detected