mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
PyCharm: remove supportsPython3 check as any modern framework support it (all impls return true)
GitOrigin-RevId: 06f939ac73ae864a04ee6bdfd09be1e54b5bda5d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a041c80947
commit
01228fba20
@@ -12,6 +12,4 @@ public interface PyFrameworkProjectGenerator {
|
||||
@NlsSafe String getFrameworkTitle();
|
||||
|
||||
boolean isFrameworkInstalled(@NotNull Sdk sdk);
|
||||
|
||||
boolean supportsPython3();
|
||||
}
|
||||
|
||||
@@ -1285,7 +1285,6 @@ python.find.module.usages.dialog.label.prefix.module=Module
|
||||
goto.superclass.choose=Choose superclass
|
||||
python.symbol.chooser.dialog.title=Choose Symbol
|
||||
button.install.to.user.site.packages.directory=Install to user's site packages directory
|
||||
framework.not.supported.for.the.selected.interpreter={0} is not supported for the selected interpreter
|
||||
|
||||
action.MarkNamespacePackageDirectory.text=Namespace package
|
||||
python.unmark.as.namespace.package=Unmark as Namespace Package
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
|
||||
import com.jetbrains.python.newProject.PyFrameworkProjectGenerator;
|
||||
@@ -39,7 +38,6 @@ import com.jetbrains.python.sdk.add.PyAddSdkGroupPanel;
|
||||
import com.jetbrains.python.sdk.add.PyAddSdkPanel;
|
||||
import com.jetbrains.python.sdk.add.v2.PythonInterpreterSelectionMode;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -222,11 +220,6 @@ public class ProjectSpecificSettingsStep<T> extends ProjectSettingsStepBase<T> i
|
||||
final PyFrameworkProjectGenerator frameworkGenerator = ObjectUtils.tryCast(myProjectGenerator, PyFrameworkProjectGenerator.class);
|
||||
|
||||
if (frameworkGenerator != null) {
|
||||
final String python3Error = validateFrameworkSupportsPython3(frameworkGenerator, sdk);
|
||||
if (python3Error != null) {
|
||||
setErrorText(python3Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Framework package check may be heavy in case of remote sdk and should not be called on AWT, pretend everything is OK for
|
||||
// remote and check for packages later
|
||||
@@ -262,12 +255,6 @@ public class ProjectSpecificSettingsStep<T> extends ProjectSettingsStepBase<T> i
|
||||
return !PythonInterpreterTargetEnvironmentFactory.Companion.isMutable(targetConfig);
|
||||
}
|
||||
|
||||
private static @Nls String validateFrameworkSupportsPython3(@NotNull PyFrameworkProjectGenerator generator, @NotNull Sdk sdk) {
|
||||
final String frameworkName = generator.getFrameworkTitle();
|
||||
final boolean isPy3k = PythonSdkType.getLanguageLevelForSdk(sdk).isPy3K();
|
||||
return isPy3k && !generator.supportsPython3() ? PyBundle.message("framework.not.supported.for.the.selected.interpreter", frameworkName)
|
||||
: null;
|
||||
}
|
||||
|
||||
private static @NotNull Pair<Boolean, List<String>> validateFramework(@NotNull PyFrameworkProjectGenerator generator, @NotNull Sdk sdk) {
|
||||
final List<String> warnings = new ArrayList<>();
|
||||
@@ -318,7 +305,7 @@ public class ProjectSpecificSettingsStep<T> extends ProjectSettingsStepBase<T> i
|
||||
|
||||
final List<Sdk> allExistingSdks = Arrays.asList(PyConfigurableInterpreterList.getInstance(null).getModel().getSdks());
|
||||
final List<Sdk> existingSdks = getValidPythonSdks(allExistingSdks);
|
||||
final Sdk preferredSdk = getPreferredSdk(existingSdks);
|
||||
final Sdk preferredSdk = existingSdks.stream().findFirst().orElse(null);
|
||||
|
||||
final String newProjectPath = getProjectLocation();
|
||||
final PyAddNewEnvironmentPanel newEnvironmentPanel = new PyAddNewEnvironmentPanel(allExistingSdks, newProjectPath, preferredEnvironment);
|
||||
@@ -361,18 +348,6 @@ public class ProjectSpecificSettingsStep<T> extends ProjectSettingsStepBase<T> i
|
||||
.replaceFirst("[name]", name);
|
||||
}
|
||||
|
||||
private @Nullable Sdk getPreferredSdk(@NotNull List<Sdk> sdks) {
|
||||
final PyFrameworkProjectGenerator projectGenerator = ObjectUtils.tryCast(getProjectGenerator(), PyFrameworkProjectGenerator.class);
|
||||
final boolean onlyPython2 = projectGenerator != null && !projectGenerator.supportsPython3();
|
||||
final Sdk preferred = ContainerUtil.getFirstItem(sdks);
|
||||
if (preferred == null) return null;
|
||||
if (onlyPython2 && !PythonSdkType.getLanguageLevelForSdk(preferred).isPython2()) {
|
||||
final Sdk python2Sdk = PythonSdkType.findPython2Sdk(sdks);
|
||||
return python2Sdk != null ? python2Sdk : preferred;
|
||||
}
|
||||
return preferred;
|
||||
}
|
||||
|
||||
public static @NotNull List<Sdk> getValidPythonSdks(@NotNull List<Sdk> existingSdks) {
|
||||
return StreamEx
|
||||
.of(existingSdks)
|
||||
|
||||
Reference in New Issue
Block a user