def _gather_module(self, package, rootdir, relpath):
        """Gather a python module file into the bundle.

        Given the name of a python module, the root import directory under
        which it was found, and the relative path from that root to the
        module file, this method copies the file into the bundle and adds it
        to the list of all available modules.
        """
        modname = os.path.basename(relpath)[:-3]
        if package:
            modname = package + "." + modname
        if not self.is_excluded(modname):
            # Add it to the list of available modules.
            moddata = {"file": relpath.replace("\\", "/")}
            self.modules[modname] = moddata
            # Copy its source file across.
            self._copy_py_file(os.path.join(rootdir, relpath),
                               os.path.join(self.bundle_dir, relpath))
            # We'll need to analyse its imports once all siblings are gathered.
            self._modules_pending_import_analysis.append(modname)
Gather a python module file into the bundle.

        Given the name of a python module, the root import directory under
        which it was found, and the relative path from that root to the
        module file, this method copies the file into the bundle and adds it
        to the list of all available modules.
        
tools/module_bundler.py