mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
`PythonSdkFlavor` detects pythons. It uses `VirtualEnvReader` under the hood (see virtual env flavor) and system pythons (see other flavors). We use it in `PythonLocalAddInterpreterModel` and cover it with tests PY-74425 WIP, PY-74236: `VirtualEnvReader` shouldn't return `null` nor should it check for dir existence, use `getVEnvRootDir` as a default dir for venv. The whole logic behind `VirtualEnvReader` is the following: we check for some env variable, and if it points to the correct path -- we use it. We fall back to the home directory otherwise. Directory doesn't need to exist (hence, no need to check `isDirectory`) because a client might always create it. Even worse: directory would probably not exist on a fresh OS, but a user still wants to create virtual envs there. PY-74425 WIP: Encapsulate python names and patterns inside `VirtualEnvReader`. `VirtualEnvReader` seems to be the main entry point to look for virtual envs on the local file system. Historically, flavors did that, so they had a set of names and patterns to filter python by name, however: 1. `UnixPythonSdkFlavor` had named for **nix only, and `VirtualEnvSdkFlavor` had names both for Windows and **nix. It is unlikely to see a `.exe ` file on **nix or file, without an extension on Windows, so this check is useless and broken (`VirtualEnvSdkFlavor` checks for both names on both OSes) 2. `UnixPythonSdkFlavor` had regex to filter Python2, but this python was removed 4 years ago and could hardly be met on any new OS; hence this check is useless. 3. New Project Wizard needs to find pythons, but knows nothing about names and patterns. Merge-request: IJ-MR-142040 Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com> GitOrigin-RevId: ce649b4f12f7c7b60a25d8e1fb1222e075337844