if (IN_TESTS) {
return new Tuple<List<ProjectConfigError>, IInterpreterInfo>(new ArrayList<ProjectConfigError>(), null);
}
ArrayList<ProjectConfigError> lst = new ArrayList<ProjectConfigError>();
if (this.project == null) {
lst.add(new ProjectConfigError(relatedToProject, "The configured nature has no associated project."));
}
IInterpreterInfo info = null;
try {
info = this.getProjectInterpreter();
String executableOrJar = info.getExecutableOrJar();
if (!new File(executableOrJar).exists()) {
lst.add(new ProjectConfigError(relatedToProject,
"The interpreter configured does not exist in the filesystem: " + executableOrJar));
}
List<String> projectSourcePathSet = new ArrayList<String>(this.getPythonPathNature()
.getProjectSourcePathSet(true));
Collections.sort(projectSourcePathSet);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
for (String path : projectSourcePathSet) {
if (path.trim().length() > 0) {
IPath p = new Path(path);
IResource resource = root.findMember(p);
if (resource == null) {
relatedToProject.refreshLocal(p.segmentCount(), null);
resource = root.findMember(p); //2nd attempt (after refresh)
}
if (resource == null || !resource.exists()) {
lst.add(new ProjectConfigError(relatedToProject, "Source folder: " + path + " not found"));
}
}
}
List<String> externalPaths = this.getPythonPathNature().getProjectExternalSourcePathAsList(true);
Collections.sort(externalPaths);
for (String path : externalPaths) {
if (!new File(path).exists()) {
lst.add(new ProjectConfigError(relatedToProject, "Invalid external source folder specified: "
+ path));
}
}
Tuple<String, String> versionAndError = getVersionAndError();
if (versionAndError.o2 != null) {
lst.add(new ProjectConfigError(relatedToProject, StringUtils.replaceNewLines(versionAndError.o2, " ")));
}
} catch (MisconfigurationException e) {
lst.add(new ProjectConfigError(relatedToProject, StringUtils.replaceNewLines(e.getMessage(), " ")));
} catch (Throwable e) {
lst.add(new ProjectConfigError(relatedToProject, StringUtils.replaceNewLines(
"Unexpected error:" + e.getMessage(), " ")));
}
return new Tuple<List<ProjectConfigError>, IInterpreterInfo>(lst, info);
}