forked from aio-libs/aiohttp-sse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
64 lines (50 loc) · 1.85 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import ast
import codecs
import os
import sys
from setuptools import setup, find_packages
PY_VER = sys.version_info
if not PY_VER >= (3, 5):
raise RuntimeError("aiohttp-sse doesn't support Python earlier than 3.5")
def read(f):
with codecs.open(os.path.join(os.path.dirname(__file__), f),
encoding='utf-8') as ofile:
return ofile.read()
class VersionFinder(ast.NodeVisitor):
def __init__(self):
self.version = None
def visit_Assign(self, node):
if not self.version:
if node.targets[0].id == '__version__':
self.version = node.value.s
def read_version():
init_py = os.path.join(os.path.dirname(__file__),
'aiohttp_sse', '__init__.py')
finder = VersionFinder()
finder.visit(ast.parse(read(init_py)))
if finder.version is None:
msg = 'Cannot find version in aiohttp_sse/__init__.py'
raise RuntimeError(msg)
return finder.version
install_requires = ['aiohttp>=2.0']
setup(name='aiohttp-sse',
version=read_version(),
description=("Server-sent events support for aiohttp."),
lond_description='\n\n'.join((read('README.rst'), read('CHANGES.txt'))),
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP',
'Framework :: AsyncIO',
],
author="Nikolay Novik",
author_email="nickolainovik@gmail.com",
url='https://github.com/aio-libs/aiohttp_sse/',
license='Apache 2',
packages=find_packages(),
install_requires=install_requires,
include_package_data=True)