卸载面板安装的Python @author baozi <202-02-22> @param: get ( dict ): 请求信息,包含要删除的版本信息 @return msg : 是否删除成功
(self, get)
| 293 | # public.writeFile(path, localtime + "\n" + msg + "\n", "a+") |
| 294 | |
| 295 | def RemovePythonV(self, get): |
| 296 | """卸载面板安装的Python |
| 297 | @author baozi <202-02-22> |
| 298 | @param: |
| 299 | get ( dict ): 请求信息,包含要删除的版本信息 |
| 300 | @return msg : 是否删除成功 |
| 301 | """ |
| 302 | v = get.version.split()[0] |
| 303 | if "is_pypy" in get and get.is_pypy in ("1", "true", 1, True): |
| 304 | path = '{}/pypy_versions'.format(self._pyv_path) |
| 305 | else: |
| 306 | path = '{}/versions'.format(self._pyv_path) |
| 307 | if not os.path.exists(path): |
| 308 | return public.returnMsg(True, "卸载Python成功") |
| 309 | python_bin = "{}/{}/bin/python".format(path, v) |
| 310 | if not os.path.exists(python_bin): |
| 311 | python_bin = "{}/{}/bin/python3".format(path, v) |
| 312 | if not os.path.exists(python_bin): |
| 313 | return public.returnMsg(False, "Python版本不存在") |
| 314 | |
| 315 | res = EnvironmentManager().multi_remove_env(os.path.realpath(python_bin)) |
| 316 | return res |
| 317 | |
| 318 | def _get_project_conf(self, name_id) -> Union[Dict, bool]: |
| 319 | """获取项目的配置信息 |
nothing calls this directly
no test coverage detected