Lines Matching +full:modules +full:- +full:2
1 """Find modules used by a script, using introspection."""
38 # of another package into sys.modules at runtime by calling
55 # Python modules.
58 # resolved, ie. a starimport from a non-Python module.
76 self.modules = {}
102 self.indent = self.indent - 1
106 self.msg(2, "run_script", pathname)
118 def import_hook(self, name, caller=None, fromlist=None, level=-1):
129 def determine_parent(self, caller, level=-1):
132 self.msgout(4, "determine_parent -> None")
137 level -= 1
139 parent = self.modules[pname]
141 self.msgout(4, "determine_parent ->", parent)
145 pname = ".".join(pname.split(".")[:-level])
146 parent = self.modules[pname]
147 self.msgout(4, "determine_parent ->", parent)
150 parent = self.modules[pname]
152 self.msgout(4, "determine_parent ->", parent)
157 parent = self.modules[pname]
159 self.msgout(4, "determine_parent ->", parent)
161 self.msgout(4, "determine_parent -> None")
179 self.msgout(4, "find_head_package ->", (q, tail))
186 self.msgout(4, "find_head_package ->", (q, tail))
203 self.msgout(4, "load_tail ->", m)
223 modules = {}
225 # But we must also collect Python extension modules - although
235 self.msg(2, "can't list directory", dir)
241 if name[-n:] == suff:
242 mod = name[:-n]
245 modules[mod] = mod
246 return modules.keys()
251 m = self.modules[fqname]
255 self.msgout(3, "import_module ->", m)
258 self.msgout(3, "import_module -> None")
261 self.msgout(3, "import_module -> None")
267 self.msgout(3, "import_module ->", None)
276 self.msgout(3, "import_module ->", m)
281 self.msgin(2, "load_module", fqname, fp and "fp", pathname)
284 self.msgout(2, "load_module ->", m)
293 self.msgout(2, "raise ImportError: " + str(exc), pathname)
305 self.msgout(2, "load_module ->", m)
314 self.badmodules[name]["-"] = 1
316 def _safe_import_hook(self, name, caller, fromlist, level=-1):
324 self.msg(2, "ImportError:", str(msg))
335 self.msg(2, "ImportError:", str(msg))
350 if (op == IMPORT_NAME and i >= 2
351 and opargs[i-1][0] == opargs[i-2][0] == LOAD_CONST):
352 level = consts[opargs[i-2][1]]
353 fromlist = consts[opargs[i-1][1]]
384 mm = self.modules.get(m.__name__ + "." + name)
386 mm = self.modules.get(name)
410 self.msgin(2, "load_package", fqname, pathname)
424 self.msgout(2, "load_package ->", m)
431 if fqname in self.modules:
432 return self.modules[fqname]
433 self.modules[fqname] = m = Module(fqname)
443 self.msgout(3, "find_module -> Excluded", fullname)
454 """Print a report to stdout, listing the found modules with their
455 paths, as well as modules that are missing, or seem to be missing.
458 print(" %-25s %s" % ("Name", "File"))
459 print(" %-25s %s" % ("----", "----"))
460 # Print modules found
461 keys = sorted(self.modules.keys())
463 m = self.modules[key]
468 print("%-25s" % key, m.__file__ or "")
470 # Print missing modules
474 print("Missing modules:")
478 # Print modules that may be missing, but then again, maybe not...
488 """Return a list of modules that appear to be missing. Use
489 any_missing_maybe() if you want to know which modules are
496 """Return two lists, one with modules that are certainly missing
497 and one with modules that *may* be missing. The latter names could
515 pkg = self.modules.get(pkgname)
526 # from a non-Python module, so we simply can't be sure.
550 self.msgout(2, "co_filename %r changed to %r" \
553 self.msgout(2, "co_filename %r remains unchanged" \
585 if o == '-d':
587 if o == '-m':
589 if o == '-p':
591 if o == '-q':
593 if o == '-x':
614 if arg == '-m':
618 if arg[-2:] == '.*':
619 mf.import_hook(arg[:-2], None, ["*"])
626 return mf # for -i debugging