1import os
2import os.path
3import shutil
4import subprocess
5import sys
6from setuptools import setup, Command
7
8
9install_requires=['cffi>=1.0.0']
10try:
11    import importlib
12except ImportError:
13    install_requires.append('importlib')
14
15dirname = os.path.dirname(os.path.abspath(__file__))
16
17
18class TestCommand(Command):
19    description = 'run tests'
20    user_options = [
21        ('include=', 'i', 'comma separated list of testcases'),
22        ('exclude=', 'e', 'comma separated list of testcases'),
23        ('benchmark', 'b', 'run bechmarks'),
24        ('list', 'l', 'list all testcases'),
25    ]
26
27    def initialize_options(self):
28        self.include = ''
29        self.exclude = ''
30        self.benchmark = 0
31        self.list = 0
32
33    def finalize_options(self):
34        pass
35
36    def run(self):
37        self.run_command('develop')
38        errno = subprocess.call([sys.executable, 'tests/run_tests.py'] + sys.argv[2:])
39        sys.exit(errno)
40
41
42setup(
43    name='misaka',
44    version='2.1.1',
45    description='A CFFI binding for Hoedown, a markdown parsing library.',
46    author='Frank Smit',
47    author_email='frank@61924.nl',
48    url='https://github.com/FSX/misaka',
49    license='MIT',
50    long_description=open(os.path.join(dirname, 'README.rst')).read(),
51    scripts=['scripts/misaka'],
52    packages=['misaka'],
53    cmdclass={
54        'test': TestCommand
55    },
56    classifiers = [
57        'Development Status :: 4 - Beta',
58        'Intended Audience :: Developers',
59        'License :: OSI Approved :: MIT License',
60        'Programming Language :: C',
61        'Programming Language :: Python :: 2.7',
62        'Programming Language :: Python :: 3.4',
63        'Programming Language :: Python :: 3.5',
64        'Programming Language :: Python :: 3.6',
65        'Programming Language :: Python :: 3.7',
66        'Programming Language :: Python :: Implementation :: CPython',
67        'Programming Language :: Python :: Implementation :: PyPy',
68        'Topic :: Text Processing :: Markup',
69        'Topic :: Text Processing :: Markup :: HTML',
70        'Topic :: Utilities'
71    ],
72    setup_requires=['cffi>=1.0.0'],
73    install_requires=install_requires,
74    cffi_modules=['build_ffi.py:ffi'],
75)
76