Lines Matching refs:mod_name
26 def __init__(self, mod_name): argument
27 self.mod_name = mod_name
28 self.module = imp.new_module(mod_name)
32 mod_name = self.mod_name
34 self._saved_module.append(sys.modules[mod_name])
37 sys.modules[mod_name] = self.module
42 sys.modules[self.mod_name] = self._saved_module[0]
44 del sys.modules[self.mod_name]
63 mod_name=None, mod_fname=None, argument
68 run_globals.update(__name__ = mod_name,
76 mod_name=None, mod_fname=None, argument
79 with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname):
82 mod_name, mod_fname, mod_loader, pkg_name)
92 def _get_filename(loader, mod_name): argument
96 return meth(mod_name)
100 def _get_module_details(mod_name, error=ImportError): argument
102 loader = get_loader(mod_name)
104 raise error("No module named %s" % mod_name)
105 ispkg = loader.is_package(mod_name)
109 if mod_name == "__main__" or mod_name.endswith(".__main__"):
111 __import__(mod_name) # Do not catch exceptions initializing package
113 pkg_main_name = mod_name + ".__main__"
117 "be directly executed") %(e, mod_name))
119 code = loader.get_code(mod_name)
123 raise error("No code object available for %s" % mod_name)
124 filename = _get_filename(loader, mod_name)
125 return mod_name, loader, code, filename
147 def _run_module_as_main(mod_name, alter_argv=True): argument
161 if alter_argv or mod_name != "__main__": # i.e. -m switch
162 mod_name, loader, code, fname = _get_module_details(
163 mod_name, _Error)
165 mod_name, loader, code, fname = _get_main_module_details(_Error)
169 pkg_name = mod_name.rpartition('.')[0]
176 def run_module(mod_name, init_globals=None, argument
182 mod_name, loader, code, fname = _get_module_details(mod_name)
184 run_name = mod_name
185 pkg_name = mod_name.rpartition('.')[0]
268 mod_name, loader, code, fname = _get_main_module_details()