(cls, path: str)
| 874 | |
| 875 | @classmethod |
| 876 | def find_venv_python(cls, path: str) -> Optional[PythonEnvironment]: |
| 877 | p = Path(path).resolve() |
| 878 | while str(p) != "/": |
| 879 | if not p.exists() or not p.is_dir(): |
| 880 | break |
| 881 | bin_path = "{}/bin/python".format(str(p)) |
| 882 | if not os.path.exists(bin_path) or not os.access(bin_path, os.X_OK): |
| 883 | bin_path = "{}/bin/python3".format(str(p)) |
| 884 | if not os.path.exists(bin_path) or not os.access(bin_path, os.X_OK): |
| 885 | p = p.parent |
| 886 | continue |
| 887 | |
| 888 | data = cls.get_env_info(str(p)) |
| 889 | if not data: |
| 890 | p = p.parent |
| 891 | continue |
| 892 | |
| 893 | site_packages = cls.get_site_packages(bin_path) |
| 894 | if not site_packages: |
| 895 | p = p.parent |
| 896 | continue |
| 897 | |
| 898 | pe = PythonEnvironment(bin_path, data[1], "venv") |
| 899 | pe.activate_sh = "source {}/bin/activate".format(str(p)) |
| 900 | pe.system_path = data[0] |
| 901 | pe.venv_name = data[2] |
| 902 | pe.site_packages = site_packages |
| 903 | return pe |
| 904 | |
| 905 | return None |
| 906 | |
| 907 | |
| 908 | class SystemPythonDetector(_EnvironmentDetector): |
no test coverage detected