fixed PY-17106

There are exceptions about exePath if conda interpreter was installed not in default location
This commit is contained in:
Ekaterina Tuzova
2015-10-05 18:23:31 +03:00
parent bc50acad3e
commit 0294485390
3 changed files with 6 additions and 2 deletions
@@ -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 {