1#!/usr/bin/env python
2
3import os
4import re
5import sys
6
7from setuptools import setup, find_packages
8
9PROJECT_ROOT = os.path.dirname(__file__)
10
11with open(os.path.join(PROJECT_ROOT, 'README.rst')) as file_:
12    long_description = file_.read()
13
14# Get the version
15version_regex = r'__version__ = ["\']([^"\']*)["\']'
16with open(os.path.join(PROJECT_ROOT, 'src/wsproto/__init__.py')) as file_:
17    text = file_.read()
18    match = re.search(version_regex, text)
19
20    if match:
21        version = match.group(1)
22    else:
23        raise RuntimeError("No version number found!")
24
25# Stealing this from Cory Benfield who stole it from Kenneth Reitz
26if sys.argv[-1] == 'publish':
27    os.system('python setup.py sdist upload')
28    sys.exit()
29
30setup(
31    name='wsproto',
32    version=version,
33    description='WebSockets state-machine based protocol implementation',
34    long_description=long_description,
35    long_description_content_type='text/x-rst',
36    author='Benno Rice',
37    author_email='benno@jeamland.net',
38    url='https://github.com/python-hyper/wsproto/',
39    packages=find_packages(where="src"),
40    package_data={'': ['LICENSE', 'README.rst', 'CHANGELOG.rst']},
41    package_dir={'': 'src'},
42    python_requires='>=3.6.1',
43    include_package_data=True,
44    license='MIT License',
45    classifiers=[
46        'Development Status :: 5 - Production/Stable',
47        'Intended Audience :: Developers',
48        'License :: OSI Approved :: MIT License',
49        'Programming Language :: Python',
50        'Programming Language :: Python :: 3',
51        'Programming Language :: Python :: 3.6',
52        'Programming Language :: Python :: 3.7',
53        'Programming Language :: Python :: 3.8',
54        'Programming Language :: Python :: 3.9',
55        'Programming Language :: Python :: Implementation :: CPython',
56        'Programming Language :: Python :: Implementation :: PyPy',
57    ],
58    install_requires=[
59        "dataclasses ; python_version < '3.7'",
60        'h11>=0.9.0,<1',
61    ],
62)
63