from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as build_ext

from Cython.Build import cythonize


with open('README.md') as f:
    long_description = f.read()


with open('httptools/_version.py') as f:
    for line in f:
        if line.startswith('__version__ ='):
            _, _, version = line.partition('=')
            VERSION = version.strip(" \n'\"")
            break
    else:
        raise RuntimeError(
            'unable to read the version from httptools/_version.py')

setup(
    name='httptools',
    version=VERSION,
    description='A collection of framework independent HTTP protocol utils.',
    long_description=long_description,
    long_description_content_type='text/markdown',
    url='https://github.com/MagicStack/httptools',
    classifiers=[
        'License :: OSI Approved :: MIT License',
        'Intended Audience :: Developers',
        'Programming Language :: Python :: 3',
        'Operating System :: POSIX',
        'Operating System :: MacOS :: MacOS X',
        'Environment :: Web Environment',
        'Development Status :: 5 - Production/Stable',
    ],
    platforms=['macOS', 'POSIX', 'Windows'],
    zip_safe=False,
    author='Yury Selivanov',
    author_email='yury@magic.io',
    license='MIT',
    packages=['httptools', 'httptools.parser'],
    ext_modules=cythonize([
        Extension(
            "httptools.parser.parser",
            ["httptools/parser/parser.pyx"],
            libraries=['http_parser']
        )
    ]),
    include_package_data=False,
    test_suite='tests.suite'
)
