mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
Revert "[python] Allow modification of python SDK in headless mode for IDEA"
This reverts commit c2ed190ada73e46752f4135f864cf279c3c1f2ca. GitOrigin-RevId: 8e27ea348debb50fc96c12cc5c93a7d2dea65d24
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4843a19133
commit
1e1f6191f7
@@ -24,6 +24,5 @@
|
||||
<typeProvider implementation="com.jetbrains.python.psi.impl.PyJavaTypeProvider"/>
|
||||
<pySuperMethodsSearch implementation="com.jetbrains.python.psi.impl.PyJavaSuperMethodsSearchExecutor"/>
|
||||
<importCandidateProvider implementation="com.jetbrains.python.psi.impl.PyJavaImportCandidateProvider"/>
|
||||
<pythonHeadlessSdkModifier implementation="com.jetbrains.python.inspections.PythonIdeaHeadlessSdkModifier"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright 2000-2023 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.project.Project
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.jetbrains.python.sdk.headless.PythonHeadlessSdkModifier
|
||||
|
||||
class PythonIdeaHeadlessSdkModifier : PythonHeadlessSdkModifier {
|
||||
|
||||
override fun setSdk(project: Project, sdk: Sdk): Boolean {
|
||||
PythonPluginCommandLineInspectionProjectConfigurator.configurePythonSdkForAllPythonModules(project, sdk, null)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.inspections;
|
||||
|
||||
import com.intellij.facet.FacetManager;
|
||||
@@ -117,10 +117,6 @@ public class PythonPluginCommandLineInspectionProjectConfigurator implements Com
|
||||
return;
|
||||
}
|
||||
|
||||
configurePythonSdkForAllPythonModules(project, null, logger);
|
||||
}
|
||||
|
||||
static void configurePythonSdkForAllPythonModules(@NotNull Project project, @Nullable Sdk sdk, @Nullable CommandLineInspectionProgressReporter logger) {
|
||||
final PythonFacetType facetType = PythonFacetType.getInstance();
|
||||
int skippedModules = 0;
|
||||
for (Module m : ModuleManager.getInstance(project).getModules()) {
|
||||
@@ -133,33 +129,24 @@ public class PythonPluginCommandLineInspectionProjectConfigurator implements Com
|
||||
|
||||
final var facet = facetManager.getFacetByType(facetType.getId());
|
||||
if (facet == null) {
|
||||
if (logger != null) {
|
||||
logger.reportMessage(3, "Setting Python facet for: " + m.getName());
|
||||
}
|
||||
logger.reportMessage(3, "Setting Python facet for: " + m.getName());
|
||||
|
||||
invokeLaterOnWriteThreadUnderLock(
|
||||
() -> {
|
||||
final PythonFacet addedFacet = facetManager.addFacet(facetType, facetType.getPresentableName(), null);
|
||||
if (sdk != null) {
|
||||
addedFacet.getConfiguration().setSdk(sdk);
|
||||
}
|
||||
PySdkExtKt.excludeInnerVirtualEnv(m, addedFacet.getConfiguration().getSdk());
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (logger != null) {
|
||||
logger.reportMessage(3, "Python facet already here: " + m.getName());
|
||||
}
|
||||
logger.reportMessage(3, "Python facet already here: " + m.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (logger != null) {
|
||||
logger.reportMessage(
|
||||
3,
|
||||
"Skipped Python interpreter configuration for " + skippedModules + " module(s) because they don't contain any Python files"
|
||||
);
|
||||
}
|
||||
logger.reportMessage(
|
||||
3,
|
||||
"Skipped Python interpreter configuration for " + skippedModules + " module(s) because they don't contain any Python files"
|
||||
);
|
||||
}
|
||||
|
||||
private static void invokeLaterOnWriteThreadUnderLock(@NotNull Runnable runnable) {
|
||||
|
||||
Reference in New Issue
Block a user