def find_package_data(<EOL>where='<STR_LIT:.>', package='<STR_LIT>',<EOL>exclude=standard_exclude,<EOL>exclude_directories=standard_exclude_directories,<EOL>only_in_packages=True,<EOL>show_ignored=False):
out = {}<EOL>stack = [(convert_path(where), '<STR_LIT>', package, only_in_packages)]<EOL>while stack:<EOL><INDENT>where, prefix, package, only_in_packages = stack.pop(<NUM_LIT:0>)<EOL>for name in os.listdir(where):<EOL><INDENT>fn = os.path.join(where, name)<EOL>if os.path.isdir(fn):<EOL><INDENT>bad_name = False<EOL>for pattern in exclude_directories:<EOL><INDENT>if (fnmatchcase(name, pattern)<EOL>or fn.lower() == pattern.lower()):<EOL><INDENT>bad_name = True<EOL>if show_ignored:<EOL><INDENT>print >> sys.stderr, (<EOL>"<STR_LIT>"<EOL>% (fn, pattern))<EOL><DEDENT>break<EOL><DEDENT><DEDENT>if bad_name:<EOL><INDENT>continue<EOL><DEDENT>if (os.path.isfile(os.path.join(fn, '<STR_LIT>'))<EOL>and not prefix):<EOL><INDENT>if not package:<EOL><INDENT>new_package = name<EOL><DEDENT>else:<EOL><INDENT>new_package = package + '<STR_LIT:.>' + name<EOL><DEDENT>stack.append((fn, '<STR_LIT>', new_package, False))<EOL><DEDENT>else:<EOL><INDENT>stack.append((fn, prefix + name + '<STR_LIT:/>', package, only_in_packages))<EOL><DEDENT><DEDENT>elif package or not only_in_packages:<EOL><INDENT>bad_name = False<EOL>for pattern in exclude:<EOL><INDENT>if (fnmatchcase(name, pattern)<EOL>or fn.lower() == pattern.lower()):<EOL><INDENT>bad_name = True<EOL>if show_ignored:<EOL><INDENT>print >> sys.stderr, (<EOL>"<STR_LIT>"<EOL>% (fn, pattern))<EOL><DEDENT>break<EOL><DEDENT><DEDENT>if bad_name:<EOL><INDENT>continue<EOL><DEDENT>out.setdefault(package, []).append(prefix + name)<EOL><DEDENT><DEDENT><DEDENT>return out<EOL>
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.

The dictionary looks like::

    {'package': [files]}

Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.

If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).

Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.

If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).

Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.