mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-17106
There are exceptions about exePath if conda interpreter was installed not in default location
This commit is contained in:
@@ -75,6 +75,7 @@ public class PyCondaPackageManagerImpl extends PyPackageManagerImpl {
|
||||
|
||||
private ProcessOutput getCondaOutput(@NotNull final String command, List<String> arguments) throws ExecutionException {
|
||||
final String condaExecutable = PyCondaPackageService.getCondaExecutable();
|
||||
if (condaExecutable == null) throw new PyExecutionException("Cannot find conda", "Conda", Collections.<String>emptyList(), new ProcessOutput());
|
||||
|
||||
final String path = getCondaDirectory();
|
||||
if (path == null) throw new PyExecutionException("Empty conda name for " + mySdk, command, arguments);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.packaging;
|
||||
|
||||
import com.intellij.execution.configurations.PathEnvironmentVariableUtil;
|
||||
import com.intellij.execution.process.ProcessOutput;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -98,6 +99,8 @@ public class PyCondaPackageService implements PersistentStateComponent<PyCondaPa
|
||||
@Nullable
|
||||
public static String getCondaExecutable() {
|
||||
final String condaName = SystemInfo.isWindows ? "conda.exe" : "conda";
|
||||
final File condaInPath = PathEnvironmentVariableUtil.findInPath(condaName);
|
||||
if (condaInPath != null) return condaInPath.getPath();
|
||||
return getCondaExecutable(condaName);
|
||||
}
|
||||
|
||||
@@ -127,7 +130,7 @@ public class PyCondaPackageService implements PersistentStateComponent<PyCondaPa
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String findExecutable(String condaName, VirtualFile condaFolder) {
|
||||
private static String findExecutable(String condaName, @Nullable final VirtualFile condaFolder) {
|
||||
if (condaFolder != null) {
|
||||
final VirtualFile bin = condaFolder.findChild(SystemInfo.isWindows ? "Scripts" : "bin");
|
||||
if (bin != null) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PyPackageManagersImpl extends PyPackageManagers {
|
||||
if (PythonSdkType.isRemote(sdk)) {
|
||||
manager = new PyRemotePackageManagerImpl(sdk);
|
||||
}
|
||||
else if (PyCondaPackageManagerImpl.isCondaVEnv(sdk)) {
|
||||
else if (PyCondaPackageManagerImpl.isCondaVEnv(sdk) && PyCondaPackageService.getCondaExecutable() != null) {
|
||||
manager = new PyCondaPackageManagerImpl(sdk);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user