The attached patch adds a mechanism to handle cases like PyXML, where a module injects itself into sys.modules under a different name. With a special version of py2exe I was able to freeze some of the PyXML test scripts, although I didn't succeed with freeze - the extension modules did not load.
Logged In: YES user_id=11105 I call ReplaceModule("_xmlplus", "xml") and then run ModuleFinder on my script. Only when the module named "_xmlplus" is loaded by load_package, the replaceModule hook is triggered. With the above call, it is then inserted into ModuleFinder's modules instance var under the name "xml", and not "_xmlplus". This mirrors what is done by _xmlplus/__init__.py file. Now that I think over it, probably ReplaceModule should be renamed to ReplacePackage ...