Search in sources :

Example 1 with PythonRunConfiguration

use of com.jetbrains.python.run.PythonRunConfiguration in project intellij-community by JetBrains.

the class PyEduDebugRunner method getScriptName.

@Nullable
private static String getScriptName(PythonCommandLineState pyState) {
    ExecutionEnvironment environment = pyState.getEnvironment();
    if (environment == null) {
        return null;
    }
    RunProfile runProfile = environment.getRunProfile();
    if (runProfile instanceof PythonRunConfiguration) {
        String name = FileUtil.toSystemIndependentName(((PythonRunConfiguration) runProfile).getScriptName());
        return SystemInfo.isWindows ? name.toLowerCase() : name;
    }
    return null;
}
Also used : ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) PythonRunConfiguration(com.jetbrains.python.run.PythonRunConfiguration) RunProfile(com.intellij.execution.configurations.RunProfile) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with PythonRunConfiguration

use of com.jetbrains.python.run.PythonRunConfiguration in project intellij-community by JetBrains.

the class PyAttachToProcessCommandLineState method create.

public static PyAttachToProcessCommandLineState create(@NotNull Project project, @NotNull String sdkPath, int port, int pid) throws ExecutionException {
    PythonRunConfiguration conf = (PythonRunConfiguration) PythonConfigurationType.getInstance().getFactory().createTemplateConfiguration(project);
    conf.setScriptName(PythonHelper.ATTACH_DEBUGGER.asParamString());
    conf.setSdkHome(sdkPath);
    conf.setScriptParameters("--port " + port + " --pid " + pid);
    ExecutionEnvironment env = ExecutionEnvironmentBuilder.create(project, DefaultDebugExecutor.getDebugExecutorInstance(), conf).build();
    return new PyAttachToProcessCommandLineState(conf, env);
}
Also used : ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) PythonRunConfiguration(com.jetbrains.python.run.PythonRunConfiguration)

Aggregations

ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2 PythonRunConfiguration (com.jetbrains.python.run.PythonRunConfiguration)2 RunProfile (com.intellij.execution.configurations.RunProfile)1 Nullable (org.jetbrains.annotations.Nullable)1