Search for runner script.

This commit is contained in:
Dmitry Trofimov
2015-08-20 14:31:19 +02:00
parent 5a001a2d4f
commit 1339924c8b
@@ -22,7 +22,6 @@ import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.HyperlinkAdapter;
@@ -272,8 +271,11 @@ public final class IpnbConnectionManager implements ProjectComponent {
return false;
}
final String homePath = sdk.getHomePath();
if (homePath == null) return false;
final String ipython = PythonSdkType.getExecutablePath(homePath, SystemInfo.isWindows ? "ipython-script.py" : "ipython");
if (homePath == null) {
showWarning(fileEditor, "Python Sdk is invalid, please check Python Interpreter in Settings->Python Interpreter", null);
return false;
}
final String ipython = findIPythonRunner(homePath);
if (ipython == null) {
showWarning(fileEditor, "IPython executable is not found, please check your IPython installation", null);
return false;
@@ -336,6 +338,18 @@ public final class IpnbConnectionManager implements ProjectComponent {
}
}
@Nullable
private static String findIPythonRunner(String homePath) {
for (String name : Lists.newArrayList("ipython", "ipython-script.py")) {
String runnerPath = PythonSdkType.getExecutablePath(homePath, name);
if (runnerPath != null) {
return runnerPath;
}
}
return null;
}
@Nullable
public static Pair<String, String> getHostPortFromUrl(@NotNull String url) {
try {