| 211 | self.path = path |
| 212 | |
| 213 | def find_module(self, fullname, path=None): |
| 214 | # Note: we ignore 'path' argument since it is only used via meta_path |
| 215 | subname = fullname.split(".")[-1] |
| 216 | if subname != fullname and self.path is None: |
| 217 | return None |
| 218 | if self.path is None: |
| 219 | path = None |
| 220 | else: |
| 221 | path = [os.path.realpath(self.path)] |
| 222 | try: |
| 223 | file, filename, etc = imp.find_module(subname, path) |
| 224 | except ImportError: |
| 225 | return None |
| 226 | return ImpLoader(fullname, file, filename, etc) |
| 227 | |
| 228 | def iter_modules(self, prefix=''): |
| 229 | if self.path is None or not os.path.isdir(self.path): |