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).
diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py
index 015708b..924c3a4 100644
--- a/Tools/freeze/modulefinder.py
+++ b/Tools/freeze/modulefinder.py
@@ -356,8 +356,12 @@
         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 @@
                 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: