Use local virtual env for inspections if available

GitOrigin-RevId: 10bb1c24430b854e79be07f1d0ff0e7f3e9f14f2
This commit is contained in:
Dmitry Trofimov
2019-09-24 10:32:45 +02:00
committed by intellij-monorepo-bot
parent e15f47fa57
commit 525e9f1aec
6 changed files with 19 additions and 8 deletions

View File

@@ -25,7 +25,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public class PythonPluginCommandLineInspectionProjectConfigurator implements CommandLineInspectionProjectConfigurator {
@Override
public boolean isApplicable(@NotNull Path projectPath, @NotNull CommandLineInspectionLogger logger) {
@@ -48,7 +47,7 @@ public class PythonPluginCommandLineInspectionProjectConfigurator implements Com
}
@Override
public void configureEnvironment(@NotNull CommandLineInspectionLogger logger) {
public void configureEnvironment(@NotNull Path projectPath, @NotNull CommandLineInspectionLogger logger) {
logger.logMessageLn(3, "Python environment configuration...");
List<Sdk> sdks = PythonSdkUtil.getAllSdks();
logger.logMessageLn(3, "Python interpreters detected:");
@@ -56,7 +55,7 @@ public class PythonPluginCommandLineInspectionProjectConfigurator implements Com
logger.logMessageLn(3, sdk.getHomePath());
}
if (sdks.isEmpty()) {
final List<Sdk> detectedSdks = PySdkExtKt.findAllPythonSdks();
final List<Sdk> detectedSdks = PySdkExtKt.findAllPythonSdks(projectPath);
if (detectedSdks.size() > 0) {
for (Sdk sdk : detectedSdks) {