(self, get)
| 3643 | return requirement_dict |
| 3644 | |
| 3645 | def get_env_info(self, get): |
| 3646 | force = False |
| 3647 | try: |
| 3648 | project_name = get.project_name.strip() |
| 3649 | if "force" in get: |
| 3650 | if isinstance(get.force, str): |
| 3651 | if get.force in ("1", "true"): |
| 3652 | force = True |
| 3653 | else: |
| 3654 | force = bool(get.force) |
| 3655 | except: |
| 3656 | return public.returnMsg(False, "参数错误") |
| 3657 | |
| 3658 | project_info = self.get_project_find(project_name) |
| 3659 | if not isinstance(project_info, dict): |
| 3660 | return public.returnMsg(False, "没有找到项目") |
| 3661 | conf = project_info["project_config"] |
| 3662 | pyenv = EnvironmentManager().get_env_py_path(conf.get("python_bin", conf.get("vpath"))) |
| 3663 | python_version = pyenv.version |
| 3664 | requirement_path = conf.get("requirement_path", "") |
| 3665 | |
| 3666 | if requirement_path and os.path.isfile(requirement_path): |
| 3667 | requirement_dict = self._read_requirement_file(requirement_path) |
| 3668 | else: |
| 3669 | requirement_dict = {} |
| 3670 | |
| 3671 | pip_list_data = pyenv.pip_list(force) |
| 3672 | pip_list = [] |
| 3673 | for p, v in pip_list_data: |
| 3674 | if p in requirement_dict: |
| 3675 | pip_list.append({"name": p, "version": v, "requirement": requirement_dict.pop(p)}) |
| 3676 | |
| 3677 | else: |
| 3678 | pip_list.append({"name": p, "version": v, "requirement": "--"}) |
| 3679 | |
| 3680 | for k, v in requirement_dict.items(): |
| 3681 | pip_list.append({"name": k, "version": "--", "requirement": v}) |
| 3682 | |
| 3683 | return { |
| 3684 | "python_version": python_version, |
| 3685 | "requirement_path": requirement_path, |
| 3686 | "pip_list": pip_list, |
| 3687 | "pip_source": self.pip_source_dict |
| 3688 | } |
| 3689 | |
| 3690 | def modify_requirement(self, get): |
| 3691 | try: |
nothing calls this directly
no test coverage detected