mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
search for sphinx-quckstart in default location
fixed PY-10238 sphinx-quickstart couldn't be found under /usr/local/bin
This commit is contained in:
@@ -36,7 +36,8 @@ public class RestPythonUtil {
|
||||
PyPackageManagerImpl manager = (PyPackageManagerImpl)PyPackageManager.getInstance(sdk);
|
||||
try {
|
||||
final PyPackage sphinx = manager.findPackage("Sphinx");
|
||||
presentation.setEnabled(sphinx != null);
|
||||
String quickStart = RestUtil.findQuickStart(sdk.getHomePath());
|
||||
presentation.setEnabled(sphinx != null && quickStart != null);
|
||||
}
|
||||
catch (PyExternalProcessException ignored) {
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.JDOMExternalizableStringList;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -20,7 +19,10 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.jetbrains.python.ReSTService;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.rest.*;
|
||||
import com.jetbrains.rest.RestBundle;
|
||||
import com.jetbrains.rest.RestFile;
|
||||
import com.jetbrains.rest.RestTokenTypes;
|
||||
import com.jetbrains.rest.RestUtil;
|
||||
import com.jetbrains.rest.psi.RestDirectiveBlock;
|
||||
import com.jetbrains.rest.psi.RestRole;
|
||||
import com.jetbrains.rest.quickfixes.AddIgnoredRoleFix;
|
||||
@@ -112,8 +114,8 @@ public class RestRoleInspection extends RestInspection {
|
||||
|
||||
Sdk sdk = ProjectRootManager.getInstance(node.getProject()).getProjectSdk();
|
||||
if (sdk != null) {
|
||||
String sphinx = RestUtil.findRunner(sdk.getHomePath(), "sphinx-quickstart" + (SystemInfo.isWindows ? ".exe" : ""));
|
||||
if (sphinx != null && !sphinx.isEmpty()) {
|
||||
String sphinx = RestUtil.findQuickStart(sdk.getHomePath());
|
||||
if (sphinx != null) {
|
||||
if (RestUtil.SPHINX_ROLES.contains(node.getText()) || RestUtil.SPHINX_ROLES.contains(":py"+node.getText())
|
||||
|| mySphinxRoles.contains(node.getRoleName())) return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.jetbrains.python.ReSTService;
|
||||
@@ -84,8 +83,6 @@ public class SphinxBaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
protected static final String ourCommand = "sphinx-quickstart"+ (SystemInfo.isWindows ? ".exe" : "");
|
||||
|
||||
public void execute(@NotNull final Module module) {
|
||||
final Project project = module.getProject();
|
||||
|
||||
@@ -141,9 +138,10 @@ public class SphinxBaseCommand {
|
||||
assert script_params != null;
|
||||
|
||||
String commandPath = getCommandPath(sdk);
|
||||
if (commandPath != null) {
|
||||
cmd.setExePath(commandPath);
|
||||
if (commandPath == null) {
|
||||
throw new ExecutionException("Cannot find sphinx-quickstart.");
|
||||
}
|
||||
cmd.setExePath(commandPath);
|
||||
|
||||
if (params != null) {
|
||||
for (String p : params) {
|
||||
@@ -171,6 +169,6 @@ public class SphinxBaseCommand {
|
||||
|
||||
@Nullable
|
||||
private static String getCommandPath(Sdk sdk) {
|
||||
return RestUtil.findRunner(sdk.getHomePath(), ourCommand);
|
||||
return RestUtil.findQuickStart(sdk.getHomePath());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user