From 38b92eb56a43cc9d67425de93b1bc4a80897f3e6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 15 Dec 1998 15:35:23 +0000 Subject: Sjoerd Mullender: When printing missing modules, also print the module they were imported from. --- Tools/freeze/hello.py | 1 + Tools/freeze/modulefinder.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Tools/freeze/hello.py b/Tools/freeze/hello.py index f978acc..31d8445 100644 --- a/Tools/freeze/hello.py +++ b/Tools/freeze/hello.py @@ -1 +1,2 @@ print 'Hello world...' +import fooblurg diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py index e406c6a..5c05c3a 100644 --- a/Tools/freeze/modulefinder.py +++ b/Tools/freeze/modulefinder.py @@ -220,6 +220,7 @@ class ModuleFinder: return m if self.badmodules.has_key(fqname): self.msgout(3, "import_module -> None") + self.badmodules[fqname][parent.__name__] = None return None try: fp, pathname, stuff = self.find_module(partname, @@ -279,7 +280,7 @@ class ModuleFinder: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) - self.badmodules[name] = None + self.badmodules[name] = {m.__name__:None} elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None @@ -289,7 +290,7 @@ class ModuleFinder: except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name - self.badmodules[fullname] = None + self.badmodules[fullname] = {m.__name__:None} else: lastname = None for c in co.co_consts: @@ -361,7 +362,9 @@ class ModuleFinder: for key in keys: # ... but not if they were explicitely excluded. if key not in self.excludes: - print "?", key + mods = self.badmodules[key].keys() + mods.sort() + print "?", key, "from", string.join(mods, ', ') def test(): -- cgit v0.12