public static List<String> getAddedPaths(Sdk pythonSdk) { List<String> pathList = new ArrayList<String>(); final SdkAdditionalData sdkAdditionalData = pythonSdk.getSdkAdditionalData(); if (sdkAdditionalData instanceof PythonSdkAdditionalData) { final Set<VirtualFile> addedPaths = ((PythonSdkAdditionalData) sdkAdditionalData).getAddedPathFiles(); for (VirtualFile file : addedPaths) { addToPythonPath(file, pathList); } } return pathList; }
private static void addLibrariesFromModule(Module module, Collection<String> list) { final OrderEntry[] entries = ModuleRootManager.getInstance(module).getOrderEntries(); for (OrderEntry entry : entries) { if (entry instanceof LibraryOrderEntry) { final String name = ((LibraryOrderEntry) entry).getLibraryName(); if (name != null && name.endsWith(LibraryContributingFacet.PYTHON_FACET_LIBRARY_NAME_SUFFIX)) { // skip libraries from Python facet continue; } for (VirtualFile root : ((LibraryOrderEntry) entry).getRootFiles(OrderRootType.CLASSES)) { final Library library = ((LibraryOrderEntry) entry).getLibrary(); if (!PlatformUtils.isPyCharm()) { addToPythonPath(root, list); } else if (library instanceof LibraryImpl) { final PersistentLibraryKind<?> kind = ((LibraryImpl) library).getKind(); if (kind == PythonLibraryType.getInstance().getKind()) { addToPythonPath(root, list); } } } } } }
private static void addRoots(Collection<String> pythonPathList, VirtualFile[] roots) { for (VirtualFile root : roots) { addToPythonPath(root, pythonPathList); } }