<commit_before>import os
import os.path
import time
import subprocess
from setuptools import setup, find_packages


def read(fname):
    with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
        return fp.read()


def runcmd(cmd):
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    out, err = p.communicate()
    return out, err


# Figure out the version.
# (this is loosely based on what Mercurial does)
try:
    if os.path.isdir('.hg'):
        cmd = ['hg', 'log', '-r', '.', '--template', '{tags}\n']
        tags, err = runcmd(cmd)
        versions = [t for t in tags.split() if t[0].isdigit()]

        cmd = ['hg', 'id', '-i']
        hgid, err = runcmd(cmd)
        hgid = hgid.strip()

        if versions:
            # Use tag found at the current revision. Add dirty flag if any.
            version = versions[-1]
            if hgid.endswith('+'):
                version += '+'
        else:
            # Use latest tag.
            cmd = ['hg', 'parents', '--template', '{latesttag}+{latesttagdistance}-']
            version, err = runcmd(cmd)
            version += hgid
        if version.endswith('+'):
            version += time.strftime('%Y%m%d')
except OSError:
    # Mercurial isn't installed, or not in the PATH.
    version = None

if version:
    f = open("wikked/__version__.py", "w")
    f.write('# this file is autogenerated by setup.py\n')
    f.write('version = "%s"\n' % version)
    f.close()


try:
    from wikked import __version__
    version = __version__.version
except ImportError:
    version = 'unknown'


setup(
        name='Wikked',
        version=version,
        description=("A wiki engine entirely managed with text files "
            "stored in a revision control system."),
        author='<NAME>',
        author_email='<EMAIL>',
        url="https://github.com/ludovicchabant/Wikked",
        license="Apache 2.0",
        keywords="wiki mercurial hg git",
        packages=find_packages(exclude=["tests"]),
        install_requires=[
            'Flask>=0.10',
            'Flask-Login>=0.1.3',
            'Flask-SQLAlchemy>=1.0',
            'Flask-Script>=0.5.1',
            'Jinja2>=2.6',
            'Markdown>=2.2.1',
            'PyYAML>=3.10',
            'Pygments>=1.5',
            'SQLAlchemy>=0.8.3',
            'Werkzeug>=0.8.3',
            'Whoosh>=2.4.1',
            'argparse>=1.2.1',
            'pybars>=0.0.4',
            'python-hglib',
            'twill>=0.9',
            'wsgiref>=0.1.2'
            ],
        scripts=['wk.py'],
        include_package_data=True,
        package_data={
            'wikked': [
                'resources/*',
                'templates/*.html',
                'static/css/wikked.min.css',
                'static/img/*.png',
                'static/js/require.js',
                'static/js/wikked.min.js',
                'static/js/pagedown/*.js'
                ]
            },
        zip_safe=False,
        classifiers=[<commit_msg>No need to package `pagedown` code separately.<commit_after>import os
import os.path
import time
import subprocess
from setuptools import setup, find_packages


def read(fname):
    with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
        return fp.read()


def runcmd(cmd):
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    out, err = p.communicate()
    return out, err


# Figure out the version.
# (this is loosely based on what Mercurial does)
try:
    if os.path.isdir('.hg'):
        cmd = ['hg', 'log', '-r', '.', '--template', '{tags}\n']
        tags, err = runcmd(cmd)
        versions = [t for t in tags.split() if t[0].isdigit()]

        cmd = ['hg', 'id', '-i']
        hgid, err = runcmd(cmd)
        hgid = hgid.strip()

        if versions:
            # Use tag found at the current revision. Add dirty flag if any.
            version = versions[-1]
            if hgid.endswith('+'):
                version += '+'
        else:
            # Use latest tag.
            cmd = ['hg', 'parents', '--template', '{latesttag}+{latesttagdistance}-']
            version, err = runcmd(cmd)
            version += hgid
        if version.endswith('+'):
            version += time.strftime('%Y%m%d')
except OSError:
    # Mercurial isn't installed, or not in the PATH.
    version = None

if version:
    f = open("wikked/__version__.py", "w")
    f.write('# this file is autogenerated by setup.py\n')
    f.write('version = "%s"\n' % version)
    f.close()


try:
    from wikked import __version__
    version = __version__.version
except ImportError:
    version = 'unknown'


setup(
        name='Wikked',
        version=version,
        description=("A wiki engine entirely managed with text files "
            "stored in a revision control system."),
        author='<NAME>',
        author_email='<EMAIL>',
        url="https://github.com/ludovicchabant/Wikked",
        license="Apache 2.0",
        keywords="wiki mercurial hg git",
        packages=find_packages(exclude=["tests"]),
        install_requires=[
            'Flask>=0.10',
            'Flask-Login>=0.1.3',
            'Flask-SQLAlchemy>=1.0',
            'Flask-Script>=0.5.1',
            'Jinja2>=2.6',
            'Markdown>=2.2.1',
            'PyYAML>=3.10',
            'Pygments>=1.5',
            'SQLAlchemy>=0.8.3',
            'Werkzeug>=0.8.3',
            'Whoosh>=2.4.1',
            'argparse>=1.2.1',
            'pybars>=0.0.4',
            'python-hglib',
            'twill>=0.9',
            'wsgiref>=0.1.2'
            ],
        scripts=['wk.py'],
        include_package_data=True,
        package_data={
            'wikked': [
                'resources/*',
                'templates/*.html',
                'static/css/wikked.min.css',
                'static/img/*.png',
                'static/js/require.js',
                'static/js/wikked.min.js'
                ]
            },
        zip_safe=False,
        classifiers=[
{'fraction_non_alphanumeric': 0.15231023102310232, 'fraction_numerical': 0.015181518151815182, 'mean_word_length': 1.7388160867600542, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, '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': '2663166', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1925, 'n_words': 420}