diff --git a/python/src/META-INF/python-core-common.xml b/python/src/META-INF/python-core-common.xml
index 7af2fee357a4..ea45045544ba 100644
--- a/python/src/META-INF/python-core-common.xml
+++ b/python/src/META-INF/python-core-common.xml
@@ -658,6 +658,7 @@
+
diff --git a/python/src/com/jetbrains/python/sdk/PreferredSdkComparator.java b/python/src/com/jetbrains/python/sdk/PreferredSdkComparator.java
index 4466b2f3d4b4..9dbf0f77acb5 100644
--- a/python/src/com/jetbrains/python/sdk/PreferredSdkComparator.java
+++ b/python/src/com/jetbrains/python/sdk/PreferredSdkComparator.java
@@ -15,6 +15,7 @@
*/
package com.jetbrains.python.sdk;
+import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.Comparing;
import com.jetbrains.python.sdk.flavors.CPythonSdkFlavor;
@@ -30,6 +31,13 @@ public class PreferredSdkComparator implements Comparator {
@Override
public int compare(Sdk o1, Sdk o2) {
+ for (PySdkComparator comparator : Extensions.getExtensions(PySdkComparator.EP_NAME)) {
+ int result = comparator.compare(o1, o2);
+ if(result != 0) {
+ return result;
+ }
+ }
+
final PythonSdkFlavor flavor1 = PythonSdkFlavor.getFlavor(o1);
final PythonSdkFlavor flavor2 = PythonSdkFlavor.getFlavor(o2);
int remote1Weight = PySdkUtil.isRemote(o1) ? 0 : 1;
@@ -48,6 +56,7 @@ public class PreferredSdkComparator implements Comparator {
if (venv1weight != venv2weight) {
return venv2weight - venv1weight;
}
+
int flavor1weight = flavor1 instanceof CPythonSdkFlavor ? 1 : 0;
int flavor2weight = flavor2 instanceof CPythonSdkFlavor ? 1 : 0;
if (flavor1weight != flavor2weight) {
@@ -56,4 +65,4 @@ public class PreferredSdkComparator implements Comparator {
return -Comparing.compare(o1.getVersionString(), o2.getVersionString());
}
-}
+}
\ No newline at end of file
diff --git a/python/src/com/jetbrains/python/sdk/PySdkComparator.java b/python/src/com/jetbrains/python/sdk/PySdkComparator.java
new file mode 100644
index 000000000000..1e792c3c2261
--- /dev/null
+++ b/python/src/com/jetbrains/python/sdk/PySdkComparator.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jetbrains.python.sdk;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.projectRoots.Sdk;
+
+/**
+ * Created by kirylch on 3/29/2017.
+ */
+public interface PySdkComparator {
+ ExtensionPointName EP_NAME = ExtensionPointName.create("Pythonid.pythonSdkComparator");
+
+ int compare(Sdk sdk1, Sdk sdk2);
+}