Convert sys.path into a list of absolute, existing, unique paths.
()
| 97 | # --------------------------------------------------------- common routines |
| 98 | |
| 99 | def pathdirs(): |
| 100 | """Convert sys.path into a list of absolute, existing, unique paths.""" |
| 101 | dirs = [] |
| 102 | normdirs = [] |
| 103 | for dir in sys.path: |
| 104 | dir = os.path.abspath(dir or '.') |
| 105 | normdir = os.path.normcase(dir) |
| 106 | if normdir not in normdirs and os.path.isdir(dir): |
| 107 | dirs.append(dir) |
| 108 | normdirs.append(normdir) |
| 109 | return dirs |
| 110 | |
| 111 | def _findclass(func): |
| 112 | cls = sys.modules.get(func.__module__) |