use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class PydevConsoleRunnerImpl method doCreateConsoleCmdLine.
@NotNull
protected GeneralCommandLine doCreateConsoleCmdLine(Sdk sdk, Map<String, String> environmentVariables, String workingDir, int[] ports, PythonHelper helper) {
GeneralCommandLine cmd = PythonCommandLineState.createPythonCommandLine(myProject, new PythonConsoleRunParams(myConsoleSettings, workingDir, sdk, environmentVariables), false, PtyCommandLine.isEnabled() && !SystemInfo.isWindows);
cmd.withWorkDirectory(myWorkingDir);
ParamsGroup group = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
helper.addToGroup(group, cmd);
for (int port : ports) {
group.addParameter(String.valueOf(port));
}
return cmd;
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class RestCommandLineState method buildCommandLineParameters.
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
ParametersList parametersList = commandLine.getParametersList();
ParamsGroup exeOptions = parametersList.getParamsGroup(GROUP_EXE_OPTIONS);
assert exeOptions != null;
exeOptions.addParametersString(myConfiguration.getInterpreterOptions());
ParamsGroup scriptParameters = parametersList.getParamsGroup(GROUP_SCRIPT);
assert scriptParameters != null;
getRunner().addToGroup(scriptParameters, commandLine);
final String key = getKey();
if (key != null)
scriptParameters.addParameter(key);
scriptParameters.addParameter(getTask());
final String params = myConfiguration.getParams();
if (params != null)
scriptParameters.addParametersString(params);
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getInputFile()))
scriptParameters.addParameter(myConfiguration.getInputFile());
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getOutputFile()))
scriptParameters.addParameter(myConfiguration.getOutputFile());
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getWorkingDirectory()))
commandLine.setWorkDirectory(myConfiguration.getWorkingDirectory());
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class SphinxBaseCommand method createCommandLine.
protected GeneralCommandLine createCommandLine(Module module, List<String> params) throws ExecutionException {
Sdk sdk = PythonSdkType.findPythonSdk(module);
if (sdk == null) {
throw new ExecutionException("No sdk specified");
}
ReSTService service = ReSTService.getInstance(module);
String sdkHomePath = sdk.getHomePath();
GeneralCommandLine cmd = new GeneralCommandLine();
if (sdkHomePath != null) {
final String runnerName = "sphinx-quickstart" + (SystemInfo.isWindows ? ".exe" : "");
String executablePath = PythonSdkType.getExecutablePath(sdkHomePath, runnerName);
if (executablePath != null) {
cmd.setExePath(executablePath);
} else {
cmd = PythonHelper.LOAD_ENTRY_POINT.newCommandLine(sdkHomePath, Lists.<String>newArrayList());
}
}
cmd.setWorkDirectory(service.getWorkdir().isEmpty() ? module.getProject().getBaseDir().getPath() : service.getWorkdir());
PythonCommandLineState.createStandardGroups(cmd);
ParamsGroup scriptParams = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
assert scriptParams != null;
if (params != null) {
for (String p : params) {
scriptParams.addParameter(p);
}
}
final Map<String, String> env = cmd.getEnvironment();
setPythonIOEncoding(env, "utf-8");
setPythonUnbuffered(env);
if (sdkHomePath != null) {
resetHomePathChanges(sdkHomePath, env);
}
env.put("PYCHARM_EP_DIST", "Sphinx");
env.put("PYCHARM_EP_NAME", "sphinx-quickstart");
List<String> pathList = Lists.newArrayList(PythonCommandLineState.getAddedPaths(sdk));
pathList.addAll(PythonCommandLineState.collectPythonPath(module));
PythonCommandLineState.initPythonPath(cmd, true, pathList, sdkHomePath);
PythonSdkType.patchCommandLineForVirtualenv(cmd, sdkHomePath, true);
BuildoutFacet facet = BuildoutFacet.getInstance(module);
if (facet != null) {
facet.patchCommandLineForBuildout(cmd);
}
return cmd;
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class PyCCCommandLineState method buildCommandLineParameters.
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
commandLine.setWorkDirectory(myTaskDir.getPath());
ParamsGroup group = commandLine.getParametersList().getParamsGroup(GROUP_SCRIPT);
assert group != null;
Project project = myRunConfiguration.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
assert course != null;
group.addParameter(myRunConfiguration.getPathToTest());
group.addParameter(new File(course.getCourseDirectory()).getPath());
String path = getCurrentTaskFilePath();
if (path != null) {
group.addParameter(path);
}
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class BuildoutFacet method patchCommandLineForBuildout.
public void patchCommandLineForBuildout(GeneralCommandLine commandLine) {
Map<String, String> env = commandLine.getEnvironment();
ParametersList params = commandLine.getParametersList();
// alter execution script
ParamsGroup scriptParams = params.getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
assert scriptParams != null;
if (scriptParams.getParameters().size() > 0) {
// expect DjangoUtil.MANAGE_FILE
String normalScript = scriptParams.getParameters().get(0);
HelperPackage engulfer = PythonHelper.BUILDOUT_ENGULFER;
env.put("PYCHARM_ENGULF_SCRIPT", getConfiguration().getScriptName());
scriptParams.getParametersList().replaceOrPrepend(normalScript, engulfer.asParamString());
}
// add pycharm helpers to pythonpath so that fixGetpass is importable
PythonEnvUtil.addToPythonPath(env, PythonHelpersLocator.getHelpersRoot().getAbsolutePath());
/*
// set prependable paths
List<String> paths = facet.getAdditionalPythonPath();
if (paths != null) {
path_value = PyUtil.joinWith(File.pathSeparator, paths);
env.put("PYCHARM_PREPEND_SYSPATH", path_value);
}
*/
}
Aggregations