<commit_before>#!/usr/bin/env python
import os
from distutils.core import setup

def find(dir):
    package, subdir = os.path.split(dir)
    matches = []
    for root, dirnames, filenames in os.walk(dir):
        root = root[len(package)+1:]
        for filename in filenames:
            matches.append(os.path.join(root, filename))
    return matches

setup(
    name = 'autodidact',
    version = '0.1',
    url = 'https://github.com/JaapJoris/autodidact',
    license = 'AGPL',
    packages = ['autodidact', 'bps', 'cas', 'adminsortable'],
    package_data = {'bps': find('bps/static') + find('bps/templates')},
    author = '<NAME>',
    author_email = '<EMAIL>',
    maintainer = '<NAME>',
    maintainer_email = '<EMAIL>',<commit_msg>Automatically find Python modules and package data when installing with setup.py<commit_after>#!/usr/bin/env python
import os
from distutils.core import setup

def find_packages(exclude=[]):
    dirs = find_package_dirs(exclude)
    return [module_name(dir) for dir in dirs]

def find_package_data(exclude=[]):
    data = {}
    for dir in find_package_dirs(exclude):
        files = find_files(dir)
        if files:
            data[module_name(dir)] = files
    return data

def find_package_dirs(exclude=[]):
    packages = []
    for curdir, dirs, files in os.walk('.'):
        dirs[:] = [d for d in dirs if d not in exclude]
        if "__init__.py" in files and os.path.dirname(curdir) in packages + ['.']:
            packages.append(curdir)
    return packages

def find_files(dir):
    matches = []
    for curdir, dirs, files in os.walk(dir):
        for file in files:
            if not file.endswith(('.py', 'pyc', '.gitignore')):
                subdir = curdir.split(dir)[1].lstrip('/')
                matches.append(os.path.join(subdir, file))
    return matches

def module_name(dir):
    return dir.lstrip('/.').replace('/', '.')

setup(
    name = 'autodidact',
    version = '0.1',
    url = 'https://github.com/JaapJoris/autodidact',
    license = 'AGPL',
    packages = find_packages(),
    package_data = find_package_data(),
    author = '<NAME>',
    author_email = '<EMAIL>',
    maintainer = '<NAME>',
    maintainer_email = '<EMAIL>',
{'fraction_non_alphanumeric': 0.1514052583862194, 'fraction_numerical': 0.0027198549410698096, 'mean_word_length': 2.96229802513465, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '430471', 'n_tokens_mistral': 738, 'n_tokens_neox': 727, 'n_words': 178}