From 9cbfa8c8dbe92af0be3b716f50ccfad076a45e79 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 6 Jul 2017 19:17:57 +0300 Subject: [PATCH] Avoid excluding site-packages if one of the modules uses the base sdk (IDEA-CR-22609) --- .../python/PyDirectoryIndexExcludePolicy.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/ide/src/com/jetbrains/python/PyDirectoryIndexExcludePolicy.java b/python/ide/src/com/jetbrains/python/PyDirectoryIndexExcludePolicy.java index f8449e67ed31..172082d3f8b7 100644 --- a/python/ide/src/com/jetbrains/python/PyDirectoryIndexExcludePolicy.java +++ b/python/ide/src/com/jetbrains/python/PyDirectoryIndexExcludePolicy.java @@ -62,12 +62,19 @@ public class PyDirectoryIndexExcludePolicy implements DirectoryIndexExcludePolic @NotNull @Override public VirtualFile[] getExcludeRootsForProjectSdk() { - List result = Lists.newArrayList(); + Set result = Sets.newHashSet(); + + Set roots = Sets.newHashSet(); + for (Module m : ModuleManager.getInstance(myProject).getModules()) { + Sdk sdk = PythonSdkType.findPythonSdk(m); + if (sdk != null) { + roots.addAll(Lists.newArrayList(sdk.getRootProvider().getFiles(OrderRootType.CLASSES))); + } + } for (Module m : ModuleManager.getInstance(myProject).getModules()) { Sdk sdk = PythonSdkType.findPythonSdk(m); if (sdk != null) { - Set roots = Sets.newHashSet(sdk.getRootProvider().getFiles(OrderRootType.CLASSES)); for (VirtualFile dir : sdk.getRootProvider().getFiles(OrderRootType.CLASSES)) { for (String name : SITE_PACKAGES) { VirtualFile sitePackages = dir.findChild(name);