コード例 #1
0
 protected boolean setWorkDir(Module module) {
   final ReSTService service = ReSTService.getInstance(module);
   String workDir = service.getWorkdir();
   if (workDir.isEmpty()) {
     AskForWorkDir dialog = new AskForWorkDir(module.getProject());
     dialog.show();
     if (!dialog.isOK()) return false;
     service.setWorkdir(dialog.getInputFile());
   }
   return true;
 }
コード例 #2
0
  protected GeneralCommandLine createCommandLine(Module module, List<String> params)
      throws ExecutionException {
    GeneralCommandLine cmd = new GeneralCommandLine();

    Sdk sdk = PythonSdkType.findPythonSdk(module);
    if (sdk == null) {
      throw new ExecutionException("No sdk specified");
    }

    ReSTService service = ReSTService.getInstance(module);
    cmd.setWorkDirectory(
        service.getWorkdir().isEmpty()
            ? module.getProject().getBaseDir().getPath()
            : service.getWorkdir());
    PythonCommandLineState.createStandardGroupsIn(cmd);
    ParamsGroup script_params =
        cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
    assert script_params != null;

    String commandPath = getCommandPath(sdk);
    if (commandPath == null) {
      throw new ExecutionException("Cannot find sphinx-quickstart.");
    }
    cmd.setExePath(commandPath);

    if (params != null) {
      for (String p : params) {
        script_params.addParameter(p);
      }
    }

    cmd.setPassParentEnvironment(true);
    setPythonIOEncoding(cmd.getEnvironment(), "utf-8");
    setPythonUnbuffered(cmd.getEnvironment());

    List<String> pathList = Lists.newArrayList(PythonCommandLineState.getAddedPaths(sdk));
    pathList.addAll(PythonCommandLineState.collectPythonPath(module));

    PythonCommandLineState.initPythonPath(cmd, true, pathList, sdk.getHomePath());

    PythonSdkType.patchCommandLineForVirtualenv(cmd, sdk.getHomePath(), true);
    BuildoutFacet facet = BuildoutFacet.getInstance(module);
    if (facet != null) {
      facet.patchCommandLineForBuildout(cmd);
    }

    return cmd;
  }