-
Notifications
You must be signed in to change notification settings - Fork 35
/
setup.py
71 lines (57 loc) · 1.96 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
65
66
67
68
69
70
71
import ast
import codecs
import os
import sys
from setuptools import find_packages, setup
PY_VER = sys.version_info
if PY_VER < (3, 9):
raise RuntimeError("aiohttp-sse doesn't support Python earlier than 3.9")
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>=3.0"]
setup(
name="aiohttp-sse",
version=read_version(),
description=("Server-sent events support for aiohttp."),
long_description=read("README.rst"),
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
"Framework :: AsyncIO",
"Framework :: aiohttp",
],
author="Nikolay Novik",
author_email="[email protected]",
url="https://github.com/aio-libs/aiohttp_sse/",
license="Apache 2",
python_requires=">=3.9",
packages=find_packages(),
install_requires=install_requires,
include_package_data=True,
)