mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
select Python 2 interpreter when selecting a project type that doesn't support Python 3; report Python 3 as incompatible when creating App Engine project
This commit is contained in:
@@ -13,4 +13,6 @@ public interface PyFrameworkProjectGenerator<T> extends DirectoryProjectGenerato
|
||||
boolean isFrameworkInstalled(Project project, Sdk sdk);
|
||||
|
||||
boolean acceptsRemoteSdk();
|
||||
|
||||
boolean supportsPython3();
|
||||
}
|
||||
|
||||
@@ -11,10 +11,17 @@ import java.util.Comparator;
|
||||
* @author yole
|
||||
*/
|
||||
public class PreferredSdkComparator implements Comparator<Sdk> {
|
||||
public static PreferredSdkComparator INSTANCE = new PreferredSdkComparator();
|
||||
|
||||
@Override
|
||||
public int compare(Sdk o1, Sdk o2) {
|
||||
final PythonSdkFlavor flavor1 = PythonSdkFlavor.getFlavor(o1);
|
||||
final PythonSdkFlavor flavor2 = PythonSdkFlavor.getFlavor(o2);
|
||||
int venv1weight = PythonSdkType.isVirtualEnv(o1) ? 0 : 1;
|
||||
int venv2weight = PythonSdkType.isVirtualEnv(o2) ? 0 : 1;
|
||||
if (venv1weight != venv2weight) {
|
||||
return venv2weight - venv1weight;
|
||||
}
|
||||
int flavor1weight = flavor1 instanceof CPythonSdkFlavor ? 1 : 0;
|
||||
int flavor2weight = flavor2 instanceof CPythonSdkFlavor ? 1 : 0;
|
||||
if (flavor1weight != flavor2weight) {
|
||||
|
||||
@@ -801,6 +801,7 @@ public class PythonSdkType extends SdkType {
|
||||
return moduleSDK;
|
||||
}
|
||||
List<Sdk> allSdks = getAllSdks();
|
||||
Collections.sort(allSdks, PreferredSdkComparator.INSTANCE);
|
||||
for (Sdk sdk : allSdks) {
|
||||
if (!getLanguageLevelForSdk(sdk).isPy3K()) {
|
||||
return sdk;
|
||||
|
||||
Reference in New Issue
Block a user