Search in sources :

Example 1 with JythonSdkFlavor

use of com.jetbrains.python.sdk.flavors.JythonSdkFlavor in project intellij-community by JetBrains.

the class PythonCommandLineState method collectPythonPath.

protected static Collection<String> collectPythonPath(Project project, PythonRunParams config, boolean isDebug) {
    final Module module = getModule(project, config);
    final HashSet<String> pythonPath = Sets.newHashSet(collectPythonPath(module, config.shouldAddContentRoots(), config.shouldAddSourceRoots()));
    if (isDebug && PythonSdkFlavor.getFlavor(config.getSdkHome()) instanceof JythonSdkFlavor) {
        //that fixes Jython problem changing sys.argv on execfile, see PY-8164
        pythonPath.add(PythonHelpersLocator.getHelperPath("pycharm"));
        pythonPath.add(PythonHelpersLocator.getHelperPath("pydev"));
    }
    return pythonPath;
}
Also used : JythonSdkFlavor(com.jetbrains.python.sdk.flavors.JythonSdkFlavor) Module(com.intellij.openapi.module.Module)

Example 2 with JythonSdkFlavor

use of com.jetbrains.python.sdk.flavors.JythonSdkFlavor in project intellij-community by JetBrains.

the class PyUnitTestTask method runConfiguration.

protected void runConfiguration(ConfigurationFactory factory, String sdkHome, final Project project) throws Exception {
    final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration("test", factory);
    AbstractPythonLegacyTestRunConfiguration config = (AbstractPythonLegacyTestRunConfiguration) settings.getConfiguration();
    config.setSdkHome(sdkHome);
    config.setScriptName(getScriptName());
    config.setWorkingDirectory(myFixture.getTempDirPath());
    PythonSdkFlavor sdk = PythonSdkFlavor.getFlavor(sdkHome);
    if (sdk instanceof JythonSdkFlavor) {
        config.setInterpreterOptions(JythonSdkFlavor.getPythonPathCmdLineArgument(Lists.<String>newArrayList(myFixture.getTempDirPath())));
    } else {
        PythonEnvUtil.addToPythonPath(config.getEnvs(), myFixture.getTempDirPath());
    }
    configure(config);
    new WriteAction() {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            RunManagerEx.getInstanceEx(project).addConfiguration(settings, false);
            RunManagerEx.getInstanceEx(project).setSelectedConfiguration(settings);
            Assert.assertSame(settings, RunManagerEx.getInstanceEx(project).getSelectedConfiguration());
        }
    }.execute();
    runConfiguration(settings, config);
}
Also used : JythonSdkFlavor(com.jetbrains.python.sdk.flavors.JythonSdkFlavor) WriteAction(com.intellij.openapi.application.WriteAction) PythonSdkFlavor(com.jetbrains.python.sdk.flavors.PythonSdkFlavor) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) AbstractPythonLegacyTestRunConfiguration(com.jetbrains.python.testing.AbstractPythonLegacyTestRunConfiguration) Result(com.intellij.openapi.application.Result)

Aggregations

JythonSdkFlavor (com.jetbrains.python.sdk.flavors.JythonSdkFlavor)2 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 Result (com.intellij.openapi.application.Result)1 WriteAction (com.intellij.openapi.application.WriteAction)1 Module (com.intellij.openapi.module.Module)1 PythonSdkFlavor (com.jetbrains.python.sdk.flavors.PythonSdkFlavor)1 AbstractPythonLegacyTestRunConfiguration (com.jetbrains.python.testing.AbstractPythonLegacyTestRunConfiguration)1