summaryrefslogtreecommitdiff
path: root/Tools/freeze/modulefinder.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-18 19:15:32 +0000
committerGuido van Rossum <guido@python.org>2001-10-18 19:15:32 +0000
commit03f7f088743bbab2dd5aa426670a41fd643112cd (patch)
treeb1427132d21ba0eb5f14120e1d91b6425e9b0826 /Tools/freeze/modulefinder.py
parentdb7287c0f5b197bbfaf624d181333a92135ec261 (diff)
downloadcpython-git-03f7f088743bbab2dd5aa426670a41fd643112cd.tar.gz
Part 2/2 of SF patch #416704: More robust freeze, by Toby Dickenson.
(With slight cosmetic improvements to shorten lines and a grammar fix to a docstring.) This addes -X and -E options to freeze. From the docstring: -X module Like -x, except the module can never be imported by the frozen binary. -E: Freeze will fail if any modules can't be found (that were not excluded using -x or -X).
Diffstat (limited to 'Tools/freeze/modulefinder.py')
-rw-r--r--Tools/freeze/modulefinder.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py
index 015708be3b..924c3a4aa3 100644
--- a/Tools/freeze/modulefinder.py
+++ b/Tools/freeze/modulefinder.py
@@ -356,8 +356,12 @@ class ModuleFinder:
return m
def find_module(self, name, path):
- if name in self.excludes:
- self.msgout(3, "find_module -> Excluded")
+ if path:
+ fullname = '.'.join(path)+'.'+name
+ else:
+ fullname = name
+ if fullname in self.excludes:
+ self.msgout(3, "find_module -> Excluded", fullname)
raise ImportError, name
if path is None:
@@ -397,6 +401,15 @@ class ModuleFinder:
mods.sort()
print "?", key, "from", string.join(mods, ', ')
+ def any_missing(self):
+ keys = self.badmodules.keys()
+ missing = []
+ for key in keys:
+ if key not in self.excludes:
+ # Missing, and its not supposed to be
+ missing.append(key)
+ return missing
+
def replace_paths_in_code(self, co):
new_filename = original_filename = os.path.normpath(co.co_filename)
for f,r in self.replace_paths: