use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class JythonSdkFlavor method initPythonPath.
@Override
public void initPythonPath(GeneralCommandLine cmd, Collection<String> path) {
initPythonPath(path, cmd.getEnvironment());
ParamsGroup paramGroup = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_EXE_OPTIONS);
assert paramGroup != null;
for (String param : paramGroup.getParameters()) {
if (param.startsWith(PYTHON_PATH_PREFIX)) {
return;
}
}
paramGroup.addParameter(getPythonPathCmdLineArgument(path));
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class PythonScriptCommandLineState method buildCommandLineParameters.
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
ParametersList parametersList = commandLine.getParametersList();
ParamsGroup exe_options = parametersList.getParamsGroup(GROUP_EXE_OPTIONS);
assert exe_options != null;
exe_options.addParametersString(myConfig.getInterpreterOptions());
ParamsGroup script_parameters = parametersList.getParamsGroup(GROUP_SCRIPT);
assert script_parameters != null;
if (!StringUtil.isEmptyOrSpaces(myConfig.getScriptName())) {
script_parameters.addParameter(myConfig.getScriptName());
}
final String script_options_string = myConfig.getScriptParameters();
if (script_options_string != null)
script_parameters.addParametersString(script_options_string);
if (!StringUtil.isEmptyOrSpaces(myConfig.getWorkingDirectory())) {
commandLine.setWorkDirectory(myConfig.getWorkingDirectory());
}
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class PythonTask method createCommandLine.
public GeneralCommandLine createCommandLine() {
GeneralCommandLine cmd = new GeneralCommandLine();
if (myWorkingDirectory != null) {
cmd.setWorkDirectory(myWorkingDirectory);
}
String homePath = mySdk.getHomePath();
if (homePath != null) {
homePath = FileUtil.toSystemDependentName(homePath);
}
PythonCommandLineState.createStandardGroups(cmd);
ParamsGroup scriptParams = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
assert scriptParams != null;
Map<String, String> env = cmd.getEnvironment();
if (!SystemInfo.isWindows && !PySdkUtil.isRemote(mySdk)) {
cmd.setExePath("bash");
ParamsGroup bashParams = cmd.getParametersList().addParamsGroupAt(0, "Bash");
bashParams.addParameter("-cl");
NotNullFunction<String, String> escaperFunction = StringUtil.escaper(false, "|>$\"'& ");
StringBuilder paramString;
if (myHelper != null) {
paramString = new StringBuilder(escaperFunction.fun(homePath) + " " + escaperFunction.fun(myHelper.asParamString()));
myHelper.addToPythonPath(cmd.getEnvironment());
} else {
paramString = new StringBuilder(escaperFunction.fun(homePath) + " " + escaperFunction.fun(myRunnerScript));
}
for (String p : myParameters) {
paramString.append(" ").append(p);
}
bashParams.addParameter(paramString.toString());
} else {
cmd.setExePath(homePath);
if (myHelper != null) {
myHelper.addToGroup(scriptParams, cmd);
} else {
scriptParams.addParameter(myRunnerScript);
}
scriptParams.addParameters(myParameters.stream().filter(o -> o != null).collect(Collectors.toList()));
}
PythonEnvUtil.setPythonUnbuffered(env);
if (homePath != null) {
PythonEnvUtil.resetHomePathChanges(homePath, env);
}
List<String> pythonPath = setupPythonPath();
PythonCommandLineState.initPythonPath(cmd, true, pythonPath, homePath);
BuildoutFacet facet = BuildoutFacet.getInstance(myModule);
if (facet != null) {
facet.patchCommandLineForBuildout(cmd);
}
return cmd;
}
Aggregations