def _build_exclusion_list(exclude):
mod_files = []<EOL>if exclude:<EOL><INDENT>for mod in exclude:<EOL><INDENT>mdir = None<EOL>mod_file = None<EOL>for token in mod.split("<STR_LIT:.>"):<EOL><INDENT>try:<EOL><INDENT>mfile, mdir, _ = imp.find_module(token, mdir and [mdir])<EOL>if mfile:<EOL><INDENT>mod_file = mfile.name<EOL>mfile.close()<EOL><DEDENT><DEDENT>except ImportError:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ValueError(msg.format(mod_name=mod))<EOL><DEDENT><DEDENT>if mod_file:<EOL><INDENT>mod_files.append(mod_file.replace("<STR_LIT>", "<STR_LIT>"))<EOL><DEDENT><DEDENT><DEDENT>return mod_files<EOL>
Build file names list of modules to exclude from exception handling.