PY-71747: Do not fail if remote interpreter has a path with ssh:// prefix.

Some remote interpreters have `sdk#homePath` starting with `ssh://`.

Code all over the monorepo assumes that `homePath` is a local file path and tries to convert it to `Path` throwing the exception effectively.

There is a `isCustomPythonSdkHomePath` which must be used to check string before trying to convert it into `Path`

The current situation (along with "solution") is a legacy from dark ages and will be rewritten to the workspace model soon

GitOrigin-RevId: 9adc02f312667571a65ff63d4e802aa7d6dbb518
This commit is contained in:
Ilya.Kazakevich
2024-05-02 02:23:04 +02:00
committed by intellij-monorepo-bot
parent 82f83b2945
commit 9f06f1a251
4 changed files with 31 additions and 21 deletions

View File

@@ -25,10 +25,7 @@ import com.jetbrains.python.PySdkBundle;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.icons.PythonPsiApiIcons;
import com.jetbrains.python.run.CommandLinePatcher;
import com.jetbrains.python.sdk.PyRemoteSdkAdditionalDataMarker;
import com.jetbrains.python.sdk.PySdkUtil;
import com.jetbrains.python.sdk.PythonEnvUtil;
import com.jetbrains.python.sdk.PythonSdkAdditionalData;
import com.jetbrains.python.sdk.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -278,7 +275,7 @@ public abstract class PythonSdkFlavor<D extends PyFlavorData> {
@Deprecated
@Nullable
public static PythonSdkFlavor<?> getFlavor(@Nullable String sdkPath) {
if (sdkPath == null) return null;
if (sdkPath == null || PythonSdkUtil.isCustomPythonSdkHomePath(sdkPath)) return null;
for (PythonSdkFlavor<?> flavor : getApplicableFlavors()) {
if (flavor.isValidSdkHome(sdkPath)) {