def _perform_pending_import_analysis(self):
        """Perform import analysis on any pending modules.

        To make it easier to resolve intra-package relative imports, we
        delay doing any import analsyis until all the contents of a package
        have been gathered into the bundle.  This method is called after
        the gathering in order to perform the pending analyses.
        """
        while self._modules_pending_import_analysis:
            modname = self._modules_pending_import_analysis.pop()
            # Check if this new module resolves previously-missing imports.
            # XXX TODO: this is pretty ugly and inefficient...
            for depname in list(self.missing):
                if self.is_dotted_prefix(modname, depname):
                    revdeps = self.missing.pop(depname)
                    for revdepname in revdeps:
                        revdepdata = self.modules[revdepname]
                        revdepdata["imports"].remove(depname)
                        if modname not in revdepdata["imports"]:
                            revdepdata["imports"].append(modname)
            # Find all the names that it imports.
            moddata = self.modules[modname]
            if "file" not in moddata:
                continue
            modpath = os.path.join(self.bundle_dir, moddata["file"])
            impf = ImportFinder(modname, modpath, self.modules)
            moddata["imports"] = impf.find_imported_modules()
            # Check for any imports that are missing from the bundle.
            for depname in moddata["imports"]:
                if depname not in self.modules:
                    if not self.is_excluded(depname):
                        if not self.is_builtin(depname):
                            if depname not in self.missing:
                                self.missing[depname] = []
                            self.missing[depname].append(modname)
Perform import analysis on any pending modules.

        To make it easier to resolve intra-package relative imports, we
        delay doing any import analsyis until all the contents of a package
        have been gathered into the bundle.  This method is called after
        the gathering in order to perform the pending analyses.
        
tools/module_bundler.py