mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Python]: Drop Jython
GitOrigin-RevId: d21b1c99e58aab59cdb474f893440e3fe61dc6df
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1ef66e99af
commit
3a8eea0329
Generated
-1
@@ -882,7 +882,6 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/python/pluginMinor/intellij.python.community.plugin.minor.iml" filepath="$PROJECT_DIR$/python/pluginMinor/intellij.python.community.plugin.minor.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/pluginMinor/intellij.python.community.plugin.minorRider/intellij.python.community.plugin.minorRider.iml" filepath="$PROJECT_DIR$/python/pluginMinor/intellij.python.community.plugin.minorRider/intellij.python.community.plugin.minorRider.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/intellij.python.community.plugin.modules.iml" filepath="$PROJECT_DIR$/python/intellij.python.community.plugin.modules.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/intellij.python.community.plugin.tests.iml" filepath="$PROJECT_DIR$/python/intellij.python.community.plugin.tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/testFramework/intellij.python.community.testFramework.iml" filepath="$PROJECT_DIR$/python/testFramework/intellij.python.community.testFramework.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/testSrc/intellij.python.community.tests.iml" filepath="$PROJECT_DIR$/python/testSrc/intellij.python.community.tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/python/python-copyright/intellij.python.copyright.iml" filepath="$PROJECT_DIR$/python/python-copyright/intellij.python.copyright.iml" />
|
||||
|
||||
Generated
+2
-1
@@ -51,6 +51,7 @@
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/android" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
@@ -36,7 +36,6 @@ public final class PythonIcons {
|
||||
|
||||
/** 16x16 */ public static final @NotNull Icon ExecuteCurrentStatement = load("icons/com/jetbrains/pythonCore/python/expui/executeCurrentStatement.svg", "icons/com/jetbrains/pythonCore/python/executeCurrentStatement.svg", -43244894, 2);
|
||||
/** 16x16 */ public static final @NotNull Icon Function = load("icons/com/jetbrains/pythonCore/python/expui/function.svg", "icons/com/jetbrains/pythonCore/python/function.svg", 1027695397, 0);
|
||||
/** 16x16 */ public static final @NotNull Icon Jython = load("icons/com/jetbrains/pythonCore/python/jython.svg", -359107473, 0);
|
||||
/** 16x16 */ public static final @NotNull Icon NumPy = load("icons/com/jetbrains/pythonCore/python/numPy.svg", 205590373, 2);
|
||||
/** 16x16 */ public static final @NotNull Icon Origami = load("icons/com/jetbrains/pythonCore/python/origami.svg", 81945933, 2);
|
||||
/** 16x16 */ public static final @NotNull Icon Pandas = load("icons/com/jetbrains/pythonCore/python/pandas.svg", -1188443833, 2);
|
||||
|
||||
@@ -469,8 +469,6 @@ class SkeletonGenerator(object):
|
||||
if not self.roots:
|
||||
return []
|
||||
# TODO Move to future InterpreterHandler
|
||||
if IS_JAVA: # jython can't have binary modules
|
||||
return []
|
||||
paths = sorted_no_case(self.roots)
|
||||
for path in paths:
|
||||
for root, files in walk_python_path(path):
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/pluginTestResources">
|
||||
<sourceFolder url="file://$MODULE_DIR$/pluginTestResources" type="java-test-resource" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/pluginTestSrc">
|
||||
<sourceFolder url="file://$MODULE_DIR$/pluginTestSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.java.testFramework" />
|
||||
<orderEntry type="module" module-name="intellij.python.community.impl" />
|
||||
<orderEntry type="module" module-name="intellij.xml.langInjection" scope="RUNTIME" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -834,7 +834,6 @@ The Python plug-in provides smart editing for Python scripts. The feature set of
|
||||
|
||||
<!-- SDK Flavors -->
|
||||
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor"/>
|
||||
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.JythonSdkFlavor"/>
|
||||
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.MacPythonSdkFlavor"/>
|
||||
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.UnixPythonSdkFlavor"/>
|
||||
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor"/>
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
<projectStructureDetector implementation="com.intellij.python.community.plugin.java.facet.PyProjectStructureDetector"/>
|
||||
<moduleConfigurationEditorProvider implementation="com.intellij.python.community.plugin.java.facet.PythonModuleConfigurationEditorProvider"/>
|
||||
<completion.contributor language="Python" implementationClass="com.intellij.python.community.plugin.java.psi.impl.PyConstructorArgumentCompletionContributor"/>
|
||||
<!-- Console folding for Jython only, thus it's located in intellij.python.plugin only -->
|
||||
<stacktrace.fold substring="*sys-package-mgr*:"/>
|
||||
<sdkEditorAdditionalOptionsProvider implementation="com.intellij.python.community.plugin.java.PythonSdkEditorAdditionalOptionsProvider"/>
|
||||
|
||||
<commandLineInspectionProjectConfigurator implementation="com.intellij.python.community.plugin.java.inspections.PythonPluginCommandLineInspectionProjectConfigurator"/>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path fill="#9BC92A" fill-rule="nonzero" d="M2.0039269,7.4 C2.10890766,6.06564668 4.30555871,5 7,5 C9.41991056,5 11.4383008,5.85955647 11.9005285,7.00134833 C11.9335535,7.00045176 11.9667134,7 12,7 C13.6568542,7 15,8.11928813 15,9.5 C15,10.8807119 13.6568542,12 12,12 L12,12.6 L11.9960731,12.6 C11.8910923,13.9343533 9.69444129,15 7,15 C4.30555871,15 2.10890766,13.9343533 2.0039269,12.6 L2,12.6 L2,7.4 L2.0039269,7.4 Z M12,11 C13.1045695,11 14,10.3284271 14,9.5 C14,8.67157288 13.1045695,8 12,8 L12,11 Z M7,9 C9.209139,9 11,8.32842712 11,7.5 C11,6.67157288 9.209139,6 7,6 C4.790861,6 3,6.67157288 3,7.5 C3,8.32842712 4.790861,9 7,9 Z"/>
|
||||
<path fill="#539C5F" fill-rule="nonzero" d="M5.706813,-3.72098186e-16 C6.56893767,-4.31078784e-16 7.16666667,-4.31078784e-16 7.5,-3.72098186e-16 C8.94588458,0.0807548514 9.88551958,0.214088185 10.318905,0.4 C11.7163354,0.999463708 12,1.8899962 12,2.8 C12,3.6 10.6666667,5.33333333 8,8 L6,8 C8.83577925,5.26547104 10.2313946,3.56547104 10.186846,2.9 C10.1533745,2.4 10.1533745,1.8 8.4323125,1.8 C8.09232193,1.8 6.90092987,2.00715533 6.106813,2.4 C5.06733871,2.91422146 4.982088,3.7 3.6,3.7 C2.952101,3.6 2,0.4 5.706813,-3.72098186e-16 Z M4,1.5 L4,2 L5,2 L5,1.5 L4,1.5 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,30 +0,0 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.jython;
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.inspections.PyCallingNonCallableInspection;
|
||||
import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
|
||||
|
||||
|
||||
public class PyJythonHighlightingTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
public void testCallableJavaClass() {
|
||||
doCallableTest();
|
||||
}
|
||||
|
||||
public void testCallableStaticMethod() {
|
||||
doCallableTest();
|
||||
}
|
||||
|
||||
private void doCallableTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".py");
|
||||
myFixture.enableInspections(PyCallingNonCallableInspection.class, PyUnresolvedReferencesInspection.class);
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PythonHelpersLocator.getPythonCommunityPath() + "/testData/highlighting/jython/";
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.jython;
|
||||
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.testFramework.JavaResolveTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.psi.PyFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@TestDataPath("$CONTENT_ROOT/../testData/resolve/pyToJava/")
|
||||
public class PyToJavaResolveTest extends JavaResolveTestCase {
|
||||
private PsiElement resolve() throws Exception {
|
||||
PsiReference ref = configureByFile(getTestName(false) + ".py");
|
||||
return ref.resolve();
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiClass);
|
||||
assertEquals("java.util.ArrayList", ((PsiClass) target).getQualifiedName());
|
||||
}
|
||||
|
||||
public void testMethod() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiMethod);
|
||||
assertEquals("java.util.ArrayList", ((PsiMethod) target).getContainingClass().getQualifiedName());
|
||||
}
|
||||
|
||||
public void testField() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiField);
|
||||
assertEquals("java.lang.System", ((PsiField) target).getContainingClass().getQualifiedName());
|
||||
}
|
||||
|
||||
public void testReturnValue() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiMethod);
|
||||
assertEquals(CommonClassNames.JAVA_UTIL_LIST, ((PsiMethod) target).getContainingClass().getQualifiedName());
|
||||
}
|
||||
|
||||
public void testPackageType() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiClass);
|
||||
assertEquals("java.util.ArrayList", ((PsiClass) target).getQualifiedName());
|
||||
}
|
||||
|
||||
public void testJavaPackage() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiPackage);
|
||||
assertEquals("java", ((PsiPackage) target).getQualifiedName());
|
||||
}
|
||||
|
||||
public void testJavaLangPackage() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiPackage);
|
||||
assertEquals("java.lang", ((PsiPackage) target).getQualifiedName());
|
||||
}
|
||||
|
||||
public void testSuperMethod() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiMethod);
|
||||
assertEquals("size", ((PsiMethod) target).getName());
|
||||
}
|
||||
|
||||
public void testFieldType() throws Exception {
|
||||
PsiElement target = resolve();
|
||||
assertTrue(target instanceof PsiMethod);
|
||||
assertEquals("println", ((PsiMethod) target).getName());
|
||||
}
|
||||
|
||||
// PY-23265, PY-23857
|
||||
public void testPurePythonSymbolsFirst() throws Exception {
|
||||
final LocalFileSystem fs = LocalFileSystem.getInstance();
|
||||
final VirtualFile tmpDir = fs.findFileByIoFile(createTempDirectory());
|
||||
copyDirContentsTo(fs.findFileByPath(getTestDataPath() + getTestName(true)), tmpDir);
|
||||
PsiTestUtil.addSourceRoot(getModule(), tmpDir.findChild("src"));
|
||||
|
||||
final PsiReference ref = configureByFile(getTestName(true) + "/src/main.py", tmpDir);
|
||||
final PsiPolyVariantReference multiRef = (PsiPolyVariantReference)ref;
|
||||
final ResolveResult[] results = multiRef.multiResolve(false);
|
||||
final List<PsiElement> targets = ContainerUtil.map(results, ResolveResult::getElement);
|
||||
|
||||
assertSize(2, targets);
|
||||
assertInstanceOf(targets.get(0), PyFile.class);
|
||||
assertInstanceOf(targets.get(1), PsiPackage.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PythonHelpersLocator.getPythonCommunityPath() + "/testData/resolve/pyToJava/";
|
||||
}
|
||||
}
|
||||
-3
@@ -955,9 +955,6 @@ public final class PyStdlibDocumentationLinkProvider implements PythonDocumentat
|
||||
|
||||
private static @NotNull String getExternalDocumentationRoot(@NotNull Sdk sdk) {
|
||||
final String versionString = sdk.getVersionString();
|
||||
if (versionString != null && StringUtil.startsWithIgnoreCase(versionString, "jython")) {
|
||||
return "http://jython.org/docs/library/";
|
||||
}
|
||||
final String pyVersion = PythonDocumentationProvider.pyVersion(versionString);
|
||||
StringBuilder urlBuilder = new StringBuilder("https://docs.python.org/");
|
||||
if (pyVersion != null) {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.run;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class JythonProcessHandler extends PythonProcessHandler {
|
||||
private JythonProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
|
||||
super(commandLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doDestroyProcess() {
|
||||
// force "kill -9" because jython makes threaddump on "SIGINT" signal
|
||||
killProcessTree(getProcess());
|
||||
}
|
||||
|
||||
public static JythonProcessHandler createProcessHandler(GeneralCommandLine commandLine)
|
||||
throws ExecutionException {
|
||||
|
||||
return new JythonProcessHandler(commandLine);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,6 @@ import com.jetbrains.python.run.target.HelpersAwareTargetEnvironmentRequest;
|
||||
import com.jetbrains.python.run.target.PySdkTargetPaths;
|
||||
import com.jetbrains.python.run.target.PythonCommandLineTargetEnvironmentProvider;
|
||||
import com.jetbrains.python.sdk.*;
|
||||
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.conda.CondaPythonExecKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -879,15 +878,8 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
boolean shouldAddContentRoots,
|
||||
boolean shouldAddSourceRoots,
|
||||
boolean isDebug) {
|
||||
final HashSet<String> pythonPath = Sets.newLinkedHashSet(collectPythonPath(module, shouldAddContentRoots, shouldAddSourceRoots));
|
||||
|
||||
if (isDebug && PythonSdkFlavor.getFlavor(sdkHome) instanceof JythonSdkFlavor) {
|
||||
//that fixes Jython problem changing sys.argv on execfile, see PY-8164
|
||||
pythonPath.add(PythonHelpersLocator.findPathStringInHelpers("pycharm"));
|
||||
pythonPath.add(PythonHelpersLocator.findPathStringInHelpers("pydev"));
|
||||
}
|
||||
|
||||
return pythonPath;
|
||||
return Sets.newLinkedHashSet(collectPythonPath(module, shouldAddContentRoots, shouldAddSourceRoots));
|
||||
}
|
||||
|
||||
private static @Nullable Module getModule(Project project, PythonRunParams config) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.ParamsGroup;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
|
||||
public final class PythonProcessRunner {
|
||||
@@ -13,15 +12,10 @@ public final class PythonProcessRunner {
|
||||
}
|
||||
|
||||
public static ProcessHandler createProcess(GeneralCommandLine commandLine, boolean softKillOnWin) throws ExecutionException {
|
||||
if (PythonSdkFlavor.getFlavor(commandLine.getExePath()) instanceof JythonSdkFlavor) {
|
||||
return JythonProcessHandler.createProcessHandler(commandLine);
|
||||
}
|
||||
else {
|
||||
if (isUnderDebugger(commandLine)) {
|
||||
return new PyDebugProcessHandler(commandLine);
|
||||
}
|
||||
return new PythonProcessHandler(commandLine);
|
||||
if (isUnderDebugger(commandLine)) {
|
||||
return new PyDebugProcessHandler(commandLine);
|
||||
}
|
||||
return new PythonProcessHandler(commandLine);
|
||||
}
|
||||
|
||||
public static ProcessHandler createProcess(GeneralCommandLine commandLine) throws ExecutionException {
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.jetbrains.python.run.target.getTargetPathForPythonConsoleExecution
|
||||
import com.jetbrains.python.sdk.PythonEnvUtil
|
||||
import com.jetbrains.python.sdk.PythonSdkAdditionalData
|
||||
import com.jetbrains.python.sdk.PythonSdkUtil
|
||||
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
@@ -92,14 +91,6 @@ private fun collectPythonPath(context: Context,
|
||||
shouldAddContentRoots,
|
||||
shouldAddSourceRoots)
|
||||
)
|
||||
if (isDebug && context.sdk?.let { PythonSdkFlavor.getFlavor(it) } is JythonSdkFlavor) {
|
||||
//that fixes Jython problem changing sys.argv on execfile, see PY-8164
|
||||
for (helpersResource in listOf("pycharm", "pydev")) {
|
||||
val helperPath = PythonHelpersLocator.findPathStringInHelpers(helpersResource)
|
||||
val targetHelperPath = targetPath(Path.of(helperPath))
|
||||
pythonPath.add(targetHelperPath)
|
||||
}
|
||||
}
|
||||
return pythonPath
|
||||
}
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.sdk.flavors;
|
||||
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.ParamsGroup;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PatternUtil;
|
||||
import com.jetbrains.python.icons.PythonIcons;
|
||||
import com.jetbrains.python.run.PythonCommandLineState;
|
||||
import com.jetbrains.python.sdk.PythonEnvUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public final class JythonSdkFlavor extends PythonSdkFlavor<PyFlavorData.Empty> {
|
||||
private static final Pattern VERSION_RE = Pattern.compile("(Jython \\S+)( on .*)?");
|
||||
private static final String JYTHONPATH = "JYTHONPATH";
|
||||
private static final String PYTHON_PATH_PREFIX = "-Dpython.path=";
|
||||
|
||||
private JythonSdkFlavor() {
|
||||
}
|
||||
|
||||
public static JythonSdkFlavor getInstance() {
|
||||
return PythonSdkFlavor.EP_NAME.findExtension(JythonSdkFlavor.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Class<PyFlavorData.Empty> getFlavorDataClass() {
|
||||
return PyFlavorData.Empty.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatformIndependent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidSdkPath(@NotNull String pathStr) {
|
||||
return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(pathStr)).startsWith("jython");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getVersionStringFromOutput(@NotNull String output) {
|
||||
return PatternUtil.getFirstMatch(Arrays.asList(StringUtil.splitByLines(output)), VERSION_RE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getVersionOption() {
|
||||
return "--version";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPythonPath(@NotNull GeneralCommandLine cmd, boolean passParentEnvs, @NotNull Collection<String> path) {
|
||||
initPythonPath(path, passParentEnvs, 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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPythonPath(@NotNull Collection<String> path, boolean passParentEnvs, @NotNull Map<String, String> env) {
|
||||
if (passParentEnvs) {
|
||||
path = PythonEnvUtil.appendSystemEnvPaths(path, JYTHONPATH);
|
||||
}
|
||||
final String jythonPath = StringUtil.join(path, File.pathSeparator);
|
||||
PythonEnvUtil.addToEnv(JYTHONPATH, jythonPath, env);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getName() {
|
||||
return "Jython";
|
||||
}
|
||||
|
||||
public static String getPythonPathCmdLineArgument(Collection<String> path) {
|
||||
return PYTHON_PATH_PREFIX + StringUtil.join(PythonEnvUtil.appendSystemEnvPaths(path, JYTHONPATH), File.pathSeparator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Icon getIcon() {
|
||||
return PythonIcons.Python.Jython;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class WinPythonSdkFlavor extends CPythonSdkFlavor<PyFlavorData.Empty> {
|
||||
@Override
|
||||
public @NotNull Collection<@NotNull Path> suggestLocalHomePaths(final @Nullable Module module, final @Nullable UserDataHolder context) {
|
||||
Set<String> candidates = new TreeSet<>();
|
||||
findInCandidatePaths(candidates, "python.exe", "jython.bat", "pypy.exe");
|
||||
findInCandidatePaths(candidates, "python.exe", "pypy.exe");
|
||||
findInstallations(candidates, "python.exe", PythonHelpersLocator.getCommunityHelpersRoot().getParent().toString());
|
||||
return ContainerUtil.map(candidates, Path::of);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ fun registerPythonSpecificEvent(group: EventLogGroup, eventId: String, vararg ex
|
||||
}
|
||||
|
||||
val PYTHON_VERSION = EventFields.StringValidatedByRegexpReference("python_version", "version")
|
||||
val PYTHON_IMPLEMENTATION = EventFields.String("python_implementation", listOf("Jython", "Python"))
|
||||
val PYTHON_IMPLEMENTATION = EventFields.String("python_implementation", listOf("Python"))
|
||||
|
||||
|
||||
enum class InterpreterTarget(val value: String) {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
from java.lang import System
|
||||
|
||||
System.ou<ref>t
|
||||
@@ -1,2 +0,0 @@
|
||||
from java.lang import System as javasystem
|
||||
javasystem.out.p<ref>rintln("Hello")
|
||||
@@ -1,3 +0,0 @@
|
||||
import java
|
||||
|
||||
java.la<ref>ng.System.out
|
||||
@@ -1 +0,0 @@
|
||||
import ja<ref>va
|
||||
@@ -1,4 +0,0 @@
|
||||
from java.util import ArrayList
|
||||
|
||||
l = ArrayList()
|
||||
l.s<ref>ize()
|
||||
@@ -1,4 +0,0 @@
|
||||
import java
|
||||
from java import util
|
||||
|
||||
l = util.ArrayLi<ref>st()
|
||||
@@ -1,4 +0,0 @@
|
||||
from java.util import Collections
|
||||
|
||||
l = Collections.emptyList()
|
||||
l.si<ref>ze()
|
||||
@@ -1,2 +0,0 @@
|
||||
from java.util import ArrayL<ref>ist
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
from java import util
|
||||
|
||||
class MyList(util.ArrayList):
|
||||
def calc_size(self):
|
||||
return self.si<ref>ze()
|
||||
@@ -1,3 +0,0 @@
|
||||
import pk<ref>g
|
||||
|
||||
print(pkg)
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -70,12 +70,6 @@ public class PyEnvTaskRunner {
|
||||
try {
|
||||
testTask.setUp(testName);
|
||||
wasExecuted = true;
|
||||
if (isJython(root)) {
|
||||
testTask.useLongTimeout();
|
||||
}
|
||||
else {
|
||||
testTask.useNormalTimeout();
|
||||
}
|
||||
final Path executable = VirtualEnvReader.getInstance().findPythonInPythonRoot(Path.of(root));
|
||||
assert executable != null : "No executable in " + root;
|
||||
|
||||
@@ -233,10 +227,6 @@ public class PyEnvTaskRunner {
|
||||
return necessaryTags.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isJython(@NotNull String sdkHome) {
|
||||
return sdkHome.toLowerCase(Locale.ROOT).contains("jython");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String formatCollectionToString(Collection<String> coll, String collName) {
|
||||
return !coll.isEmpty() ? collName + ": " + StringUtil.join(coll, ", ") + "\n" : "";
|
||||
|
||||
@@ -85,8 +85,6 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public abstract class PyExecutionFixtureTestTask extends PyTestTask {
|
||||
public static final int NORMAL_TIMEOUT = 30000;
|
||||
public static final int LONG_TIMEOUT = 120000;
|
||||
protected int myTimeout = NORMAL_TIMEOUT;
|
||||
protected CodeInsightTestFixture myFixture;
|
||||
|
||||
@Nullable
|
||||
@@ -119,15 +117,6 @@ public abstract class PyExecutionFixtureTestTask extends PyTestTask {
|
||||
return myFixture.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useNormalTimeout() {
|
||||
myTimeout = NORMAL_TIMEOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useLongTimeout() {
|
||||
myTimeout = LONG_TIMEOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns virt file by path. May be relative or not.
|
||||
@@ -236,11 +225,11 @@ public abstract class PyExecutionFixtureTestTask extends PyTestTask {
|
||||
}
|
||||
|
||||
protected boolean waitFor(ProcessHandler p) {
|
||||
return p.waitFor(myTimeout);
|
||||
return p.waitFor(NORMAL_TIMEOUT);
|
||||
}
|
||||
|
||||
protected boolean waitFor(@NotNull Semaphore s) throws InterruptedException {
|
||||
return waitFor(s, myTimeout);
|
||||
return waitFor(s, NORMAL_TIMEOUT);
|
||||
}
|
||||
|
||||
protected static boolean waitFor(@NotNull Semaphore s, long timeout) throws InterruptedException {
|
||||
|
||||
@@ -57,12 +57,6 @@ public abstract class PyTestTask {
|
||||
public void doFinally() {
|
||||
}
|
||||
|
||||
public void useNormalTimeout() {
|
||||
}
|
||||
|
||||
public void useLongTimeout() {
|
||||
}
|
||||
|
||||
public String getScriptName() {
|
||||
return myScriptName;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask {
|
||||
int matches;
|
||||
|
||||
while ((matches = StringUtil.getOccurrenceCount(output(), string)) != times) {
|
||||
if (System.currentTimeMillis() - started > myTimeout) {
|
||||
if (System.currentTimeMillis() - started > NORMAL_TIMEOUT) {
|
||||
Assert.fail("The substring '" + string + "' appeared in the output " + matches + " times, must be " + times + " times.\n" +
|
||||
output());
|
||||
}
|
||||
@@ -492,7 +492,7 @@ public abstract class PyBaseDebuggerTask extends PyExecutionFixtureTestTask {
|
||||
long started = System.currentTimeMillis();
|
||||
|
||||
while (!containsOneOf(output(), string)) {
|
||||
if (System.currentTimeMillis() - started > myTimeout) {
|
||||
if (System.currentTimeMillis() - started > NORMAL_TIMEOUT) {
|
||||
Assert.fail("None of '" + StringUtil.join(string, ", ") + "'" + " is not present in output.\n" + output());
|
||||
}
|
||||
Thread.sleep(2000);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class PyConsoleTask extends PyExecutionFixtureTestTask {
|
||||
@Nullable
|
||||
@Override
|
||||
public Set<String> getTagsToCover() {
|
||||
return Sets.newHashSet("python3.8", "python2.7", "ipython", "ipython780", "jython", "IronPython");
|
||||
return Sets.newHashSet("python3.8", "python2.7", "ipython", "ipython780");
|
||||
}
|
||||
|
||||
public PythonConsoleView getConsoleView() {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PyDebuggerTask extends PyCustomConfigDebuggerTask {
|
||||
@Nullable
|
||||
@Override
|
||||
public Set<String> getTagsToCover() {
|
||||
return Sets.newHashSet("python2.7", "python3.5", "python3.6", "python3.7", "python3.8", "jython");
|
||||
return Sets.newHashSet("python2.7", "python3.5", "python3.6", "python3.7", "python3.8");
|
||||
}
|
||||
|
||||
protected boolean usePytestRunner() {
|
||||
|
||||
@@ -98,12 +98,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
""");
|
||||
waitForOutput("101");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Sets.newHashSet("-jython"); //jython doesn't support multiline execution: http://bugs.jython.org/issue2106
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -123,12 +117,6 @@ public class PythonConsoleTest extends PyEnvTestCase {
|
||||
waitForFinish();
|
||||
waitForReady();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Sets.newHashSet("-iron", "-jython");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@EnvTestTagsRequired(tags = {"-iron", "-jython"})
|
||||
@Test
|
||||
public void testMultiprocessingSubprocess() {
|
||||
runPythonTest(new PyDebuggerMultiprocessTask("/debug", "test_multiprocess_args.py") {
|
||||
@@ -87,7 +86,6 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@EnvTestTagsRequired(tags = {"-iron", "-jython"})
|
||||
@Test
|
||||
public void testPythonSubprocessWithCParameter() {
|
||||
runPythonTest(new PyDebuggerMultiprocessTask("/debug", "test_python_subprocess_with_c_parameter.py") {
|
||||
@@ -104,11 +102,6 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
waitForOutput("Hello!");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return ImmutableSet.of("-iron", "-jython");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,7 +142,6 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@EnvTestTagsRequired(tags = {"-iron", "-jython"})
|
||||
@Test
|
||||
public void testMultiprocessProcess() {
|
||||
runPythonTest(new PyDebuggerMultiprocessTask("/debug", "test_multiprocess_process.py") {
|
||||
|
||||
@@ -151,11 +151,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForOutput("command was GO!");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython"); //can't run on jython
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -277,11 +272,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForTerminate();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -302,11 +293,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForTerminate();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -354,11 +340,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForTerminate();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return ImmutableSet.of("-jython", "-iron");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -381,11 +362,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForTerminate();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return ImmutableSet.of("-jython", "-iron");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -434,11 +411,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
resume();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython"); //TODO: fix that for Jython if anybody needs it
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -473,11 +445,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
resume();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython"); //TODO: fix that for Jython if anybody needs it
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -500,11 +467,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
resume();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return Collections.singleton("-jython"); //TODO: fix that for Jython if anybody needs it
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1321,11 +1283,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
waitForOutput(BYTES_ARGS_WARNING);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return ImmutableSet.of("-iron", "-jython");
|
||||
}
|
||||
}
|
||||
|
||||
Arrays.asList("test_call_exec_with_bytes_args.py", "test_call_spawn_with_bytes_args.py")
|
||||
|
||||
@@ -90,7 +90,7 @@ class PyRunTest : PyEnvTestCase() {
|
||||
runInEdt {
|
||||
runner.execute(env)
|
||||
}
|
||||
val await = latch.await(myTimeout.toLong(), TimeUnit.MILLISECONDS)
|
||||
val await = latch.await(NORMAL_TIMEOUT.toLong(), TimeUnit.MILLISECONDS)
|
||||
handlerRef.get()?.destroyProcess()
|
||||
Assert.assertTrue("Test frozen", await)
|
||||
connection.disconnect()
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.sdk.PythonSdkAdditionalData;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.UnixPythonSdkFlavor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,24 +45,7 @@ public class PySdkFlavorTest extends PyTestCase {
|
||||
assertEquals(LanguageLevel.PYTHON34, flavor.getLanguageLevel(mockSdk));
|
||||
}
|
||||
|
||||
public void testJythonVersionString() {
|
||||
final PythonSdkFlavor flavor = JythonSdkFlavor.getInstance();
|
||||
final String versionOutput = "Jython 2.6.3\n";
|
||||
final Sdk mockSdk = createMockSdk(flavor, versionOutput);
|
||||
assertEquals("Jython 2.6.3", mockSdk.getVersionString());
|
||||
assertEquals(LanguageLevel.PYTHON26, flavor.getLanguageLevel(mockSdk));
|
||||
}
|
||||
|
||||
public void testJythonWithWarningsVersionString() {
|
||||
final PythonSdkFlavor flavor = JythonSdkFlavor.getInstance();
|
||||
final String versionOutput = """
|
||||
"my" variable $jythonHome masks earlier declaration in same scope at /usr/bin/jython line 15.
|
||||
Jython 2.6.3
|
||||
""";
|
||||
final Sdk mockSdk = createMockSdk(flavor, versionOutput);
|
||||
assertEquals("Jython 2.6.3", mockSdk.getVersionString());
|
||||
assertEquals(LanguageLevel.PYTHON26, flavor.getLanguageLevel(mockSdk));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user