-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.py
94 lines (77 loc) · 2.73 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""Setup module."""
import re
from setuptools import setup
from pkg_resources import parse_requirements
def read_file(filename):
"""Read file correctly."""
with open(filename) as _file:
return _file.read().strip()
def requirements(filename):
"""Parse requirements from file."""
return [str(r) for r in parse_requirements(read_file(filename))]
def version():
data = read_file("./aiosonic/version.py")
return re.findall(r"VERSION = \"([a-z0-9.]*)\"", data)[0]
# copied form uvicorn, mark to not install uvloop in windows
env_marker = (
"sys_platform != 'win32'"
" and sys_platform != 'cygwin'"
" and platform_python_implementation != 'PyPy'"
)
pypy_marker = "platform_python_implementation != 'PyPy'"
def add_marks(dependencies, marks):
"""Add markers to dependencies.
Example:
uvloop==0.12.0 -> uvloop==0.12.0 ; sys_platform != 'win32'...
"""
def _map_func(dependency):
for item, marker in marks.items():
if item in dependency:
return dependency + marker
return dependency
return list(map(_map_func, dependencies))
setup(
name="aiosonic",
version=version(),
description="Async http client",
author="Johanderson Mogollon",
author_email="johanderson@mogollon.com.ve",
long_description=read_file("README.md"),
long_description_content_type="text/markdown",
license="MIT",
packages=[
"aiosonic",
"aiosonic_utils",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
install_requires=requirements("./requirements.txt"),
extras_require={
"test": add_marks(
requirements("./test-requirements.txt"),
{
"uvloop": " ;" + env_marker,
"httptools": " ;" + env_marker,
"mypy": " ;" + pypy_marker,
"mypy-extensions": " ;" + pypy_marker,
"pytest-mypy": " ;" + pypy_marker,
"typed-ast": " ;" + pypy_marker,
},
)
},
)