| 974 | failed_interpreters = OrderedDict() # type: MutableMapping[str, Text] |
| 975 | |
| 976 | def iter_interpreters(): |
| 977 | # type: () -> Iterator[PythonInterpreter] |
| 978 | for candidate in cls._find( |
| 979 | cls._paths(paths=paths), path_filter=path_filter, error_handler=Retain[str]() |
| 980 | ): |
| 981 | if isinstance(candidate, cls): |
| 982 | yield candidate |
| 983 | else: |
| 984 | python, exception = cast("InterpreterIdentificationJobError", candidate) |
| 985 | if isinstance(exception, Job.Error) and exception.stderr: |
| 986 | # We spawned a subprocess to identify the interpreter but the interpreter |
| 987 | # could not run our identification code meaning the interpreter is either |
| 988 | # broken or old enough that it either can't parse our identification code |
| 989 | # or else provide stdlib modules we expect. The stderr should indicate the |
| 990 | # broken-ness appropriately. |
| 991 | failed_interpreters[python] = exception.stderr.strip() |
| 992 | else: |
| 993 | # We couldn't even spawn a subprocess to identify the interpreter. The |
| 994 | # likely OSError should help identify the underlying issue. |
| 995 | failed_interpreters[python] = repr(exception) |
| 996 | |
| 997 | for interpreter in cls._filter(iter_interpreters()): |
| 998 | yield interpreter |