<commit_before>#!/usr/bin/env python

import sys
from setuptools import setup, find_packages
import errno
import os


if sys.argv[1] == 'install':
    os.system('./make_doc.sh')

    try:
        os.mkdir('etc/certain')
    except OSError, e:
        if e.errno != errno.EEXIST:
            raise

    #Copy certain.cfg.defaults to certain.cfg
    with open('etc/certain/certain.cfg', 'w') as c:
        c.write("# Certain's default configuration is given below.\n"
                "# Uncomment lines as appropriate to change.\n\n")
        with open('certain/certain.cfg.defaults') as f:
            for line in f:
                c.write("#" + line)

setup(
    name = 'certain',
    version = '0.1.0',
    description = 'X509 Certificate Management & Distribution Service',
    author = '<NAME>',
    author_email = '<EMAIL>',
    url = 'http://www.example.com/certain',
    packages = find_packages(),
    include_package_data = True,
    package_data = {'': ['certain.cfg.defaults']},
    install_requires = ['dulwich', 'M2Crypto', 'git'],
    scripts = ['bin/certain', 'bin/storeserver'],
    data_files = [
        (os.path.join('/etc', 'init.d'), ['etc/init.d/certain']),
        (os.path.join('/etc', 'certain'), ['etc/certain/certain.cfg']),
        (os.path.join('share', 'man', 'man8'), ['man/certain.8']),
        (os.path.join('share', 'man', 'man5'), ['man/certain.cfg.5']),
        (os.path.join('share', 'doc', 'certain', 'html'),
             [os.path.join('apidoc', name) for name in os.listdir('apidoc')]),
        ]
    )<commit_msg>Walk sphinx docs tree and add to data_files list.<commit_after>#!/usr/bin/env python

import sys
from setuptools import setup, find_packages
import errno
import os


if sys.argv[1] == 'install':
    os.system('./make_doc.sh')

    try:
        os.mkdir('etc/certain')
    except OSError, e:
        if e.errno != errno.EEXIST:
            raise

    #Copy certain.cfg.defaults to certain.cfg
    with open('etc/certain/certain.cfg', 'w') as c:
        c.write("# Certain's default configuration is given below.\n"
                "# Uncomment lines as appropriate to change.\n\n")
        with open('certain/certain.cfg.defaults') as f:
            for line in f:
                c.write("#" + line)

    data_files = []

    #Generate a list of sphinx doc paths to install
    sphinxfiles = []
    for (dirpath, dirs, files) in os.walk(os.path.join('sphinx', 'build')):
        #strip off the initial 'sphinx/build/' for tgt path creation
        subdir = dirpath[13:]
        for name in files:
            sphinxfiles.append(
                (os.path.join('share', 'doc', 'certain', 'html', subdir),
                 [os.path.join(dirpath, name)]))

    #Add data files to array
    data_files.extend(sphinxfiles)
    data_files.append(
        (os.path.join('/etc', 'init.d'), ['etc/init.d/certain']))
    data_files.append(
        (os.path.join('/etc', 'certain'), ['etc/certain/certain.cfg']))
    data_files.append(
        (os.path.join('share', 'man', 'man8'), ['man/certain.8']))
    data_files.append(
        (os.path.join('share', 'man', 'man5'), ['man/certain.cfg.5']))

setup(
    name = 'certain',
    version = '0.1.0',
    description = 'X509 Certificate Management & Distribution Service',
    author = '<NAME>',
    author_email = '<EMAIL>',
    url = 'http://www.example.com/certain',
    packages = find_packages(),
    include_package_data = True,
    package_data = {'': ['certain.cfg.defaults']},
    install_requires = ['dulwich', 'M2Crypto', 'git'],
    scripts = ['bin/certain', 'bin/storeserver'],
    data_files = data_files
    )
{'fraction_non_alphanumeric': 0.17178423236514523, 'fraction_numerical': 0.007192254495159059, 'mean_word_length': 2.616, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2380124', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1154, 'n_words': 276}