mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] PY-83881 Remove unused API in sdk configuration
GitOrigin-RevId: 5a38b57db1c90279cea4dfbafb682b8227511138
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a03643bb9c
commit
ffaee73f12
+5
-17
@@ -3,8 +3,6 @@ package com.jetbrains.python.sdk.configuration
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.progress.runBlockingMaybeCancellable
|
||||
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
|
||||
import com.jetbrains.python.PyToolUIInfo
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.CheckReturnValue
|
||||
@@ -22,22 +20,12 @@ interface PyProjectSdkConfigurationExtension {
|
||||
@JvmStatic
|
||||
val EP_NAME: ExtensionPointName<PyProjectSdkConfigurationExtension> = ExtensionPointName.create("Pythonid.projectSdkConfigurationExtension")
|
||||
|
||||
@JvmStatic
|
||||
@RequiresBackgroundThread
|
||||
fun findForModule(module: Module): CreateSdkInfo? = runBlockingMaybeCancellable {
|
||||
EP_NAME.extensionsIfPointIsRegistered.firstNotNullOfOrNull { ext -> ext.checkEnvironmentAndPrepareSdkCreator(module) }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@RequiresBackgroundThread
|
||||
/**
|
||||
* We return all configurators in a sorted order. The order is determined by extensions order, but existing environments have a
|
||||
* higher priority. That means we first have all existing envs, and only after SDK creators that extensions can manage.
|
||||
*/
|
||||
fun findAllSortedForModule(module: Module): List<CreateSdkInfo> = runBlockingMaybeCancellable {
|
||||
EP_NAME.extensionsIfPointIsRegistered
|
||||
/**
|
||||
* We return all configurators in a sorted order. The order is determined by extensions order, but existing environments have a
|
||||
* higher priority. That means we first have all existing envs, and only after SDK creators that extensions can manage.
|
||||
*/
|
||||
suspend fun findAllSortedForModule(module: Module): List<CreateSdkInfo> = EP_NAME.extensionsIfPointIsRegistered
|
||||
.mapNotNull { e -> e.checkEnvironmentAndPrepareSdkCreator(module) }.sorted()
|
||||
}
|
||||
}
|
||||
|
||||
val toolInfo: PyToolUIInfo
|
||||
|
||||
@@ -59,6 +59,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.intellij.python.sdkConfigurator.common.PublicApiKt.detectSdkForModulesIn;
|
||||
import static com.jetbrains.python.inspections.PyInterpreterInspectionExKt.findAllSortedForModuleForJvm;
|
||||
|
||||
|
||||
public final class PyInterpreterInspection extends PyInspection {
|
||||
@@ -130,7 +131,7 @@ public final class PyInterpreterInspection extends PyInspection {
|
||||
|
||||
final UserDataHolderBase context = new UserDataHolderBase();
|
||||
|
||||
final List<CreateSdkInfo> createSdkInfos = PyProjectSdkConfigurationExtension.findAllSortedForModule(module);
|
||||
final List<CreateSdkInfo> createSdkInfos = findAllSortedForModuleForJvm(module);
|
||||
if (!createSdkInfos.isEmpty()) {
|
||||
return new UseProvidedInterpreterFix(module, createSdkInfos.getFirst());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.inspections
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.progress.runBlockingMaybeCancellable
|
||||
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
|
||||
import com.jetbrains.python.sdk.configuration.CreateSdkInfo
|
||||
import com.jetbrains.python.sdk.configuration.PyProjectSdkConfigurationExtension
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* To be used by [PyInterpreterInspection] only
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@RequiresBackgroundThread
|
||||
internal fun findAllSortedForModuleForJvm(module: Module): List<CreateSdkInfo> = runBlockingMaybeCancellable {
|
||||
PyProjectSdkConfigurationExtension.findAllSortedForModule(module)
|
||||
}
|
||||
Reference in New Issue
Block a user