mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
DS-1519: use method PyCondaPackageService#getCondaBasePython to retrieve base conda interpreter SDK
DS-1519 Make "Launch DataSpell" button disabled and provide corresponding messages when no valid environment configuration selected on environment tab GitOrigin-RevId: 6ccde477ddd0beea348cdc364cf2d89857094eaf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7163a25b10
commit
5f3e25f153
@@ -80,18 +80,13 @@ public class PyCondaPackageService implements PersistentStateComponent<PyCondaPa
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getPythonName() {
|
||||
private static String getPythonName() {
|
||||
return SystemInfo.isWindows ? "python.exe" : "python";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getCondaName() {
|
||||
return SystemInfo.isWindows ? "conda.exe" : "conda";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getSystemCondaExecutable() {
|
||||
final String condaName = getCondaName();
|
||||
final String condaName = SystemInfo.isWindows ? "conda.exe" : "conda";
|
||||
final File condaInPath = PathEnvironmentVariableUtil.findInPath(condaName);
|
||||
if (condaInPath != null) return condaInPath.getPath();
|
||||
return getCondaExecutableByName(condaName);
|
||||
|
||||
@@ -43,8 +43,7 @@ import com.intellij.util.PathUtil
|
||||
import com.intellij.util.ThreeState
|
||||
import com.intellij.webcore.packaging.PackagesNotificationPanel
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.packaging.PyCondaPackageService.getCondaName
|
||||
import com.jetbrains.python.packaging.PyCondaPackageService.getPythonName
|
||||
import com.jetbrains.python.packaging.PyCondaPackageService
|
||||
import com.jetbrains.python.packaging.ui.PyPackageManagementService
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import com.jetbrains.python.sdk.flavors.CondaEnvSdkFlavor
|
||||
@@ -116,14 +115,9 @@ fun detectCondaEnvs(module: Module?, existingSdks: List<Sdk>, context: UserDataH
|
||||
filterSuggestedPaths(CondaEnvSdkFlavor.getInstance().suggestHomePaths(module, context), existingSdks, module, true)
|
||||
|
||||
fun guessCondaBaseEnvironment(condaPath: String): Sdk? {
|
||||
if (!condaPath.endsWith(File.separatorChar + getCondaName())) {
|
||||
return null
|
||||
}
|
||||
|
||||
val interpreterPath = condaPath.replaceAfterLast(File.separatorChar, getPythonName())
|
||||
val condaVirtualFile = VfsUtil.findFileByIoFile(File(interpreterPath), false)
|
||||
if (condaVirtualFile != null && condaVirtualFile.exists()) {
|
||||
return PyDetectedSdk(condaVirtualFile.path)
|
||||
val condaBasePython = PyCondaPackageService.getCondaBasePython(condaPath)
|
||||
if (condaBasePython != null) {
|
||||
return PyDetectedSdk(condaBasePython)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user