193 if not any(libpath.startswith(p) for p in stdlib_prefixes): # no-py24 |
193 if not any(libpath.startswith(p) for p in stdlib_prefixes): # no-py24 |
194 continue |
194 continue |
195 if 'site-packages' in libpath: |
195 if 'site-packages' in libpath: |
196 continue |
196 continue |
197 for top, dirs, files in os.walk(libpath): |
197 for top, dirs, files in os.walk(libpath): |
|
198 for i, d in reversed(list(enumerate(dirs))): |
|
199 if not os.path.exists(os.path.join(top, d, '__init__.py')): |
|
200 del dirs[i] |
198 for name in files: |
201 for name in files: |
199 if name == '__init__.py': |
202 if name == '__init__.py': |
200 continue |
203 continue |
201 if not (name.endswith('.py') or name.endswith('.so') |
204 if not (name.endswith('.py') or name.endswith('.so') |
202 or name.endswith('.pyd')): |
205 or name.endswith('.pyd')): |
203 continue |
206 continue |
204 full_path = os.path.join(top, name) |
207 full_path = os.path.join(top, name) |
205 if 'site-packages' in full_path: |
|
206 continue |
|
207 rel_path = full_path[len(libpath) + 1:] |
208 rel_path = full_path[len(libpath) + 1:] |
208 mod = dotted_name_of_path(rel_path) |
209 mod = dotted_name_of_path(rel_path) |
209 yield mod |
210 yield mod |
210 |
211 |
211 stdlib_modules = set(list_stdlib_modules()) |
212 stdlib_modules = set(list_stdlib_modules()) |