Looks up the modules for the given path and returns a list of the
    packages.  If the recurse flag is set to True, then it will look
    through the package recursively.
    
    :param      path    | <str>
                recurse | <bool>
    
    :return     ([<str>, ..] modules, [<str>, ..] paths)

def findmodules(path, recurse=False):
    """
    Looks up the modules for the given path and returns a list of the
    packages.  If the recurse flag is set to True, then it will look
    through the package recursively.
    
    :param      path    | <str>
                recurse | <bool>
    
    :return     ([<str>, ..] modules, [<str>, ..] paths)
    """
    output = set()
    roots = set()
    for root, folders, files in os.walk(path):
        # add packages
        for folder in folders:
            pkgpath = os.path.join(root, folder, '__init__.py')
            if os.path.exists(pkgpath):
                output.add(packageFromPath(pkgpath))

        # add modules
        rootpth = packageRootPath(root)
        rootpkg = packageFromPath(root)
        roots.add(rootpth)
        for file_ in files:
            name, ext = os.path.splitext(file_)
            if ext not in ('.py', '.pyo', '.pyc'):
                continue

            if name in ('__init__', '__plugins__'):
                continue

            if rootpkg:
                output.add(rootpkg + '.' + name)
            else:
                output.add(name)

        if not recurse:
            break

    return list(output), list(roots)