forked from sonic182/aiosonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
82 lines (64 loc) · 2.03 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
"""Setup module."""
import re
from setuptools import setup
RGX = re.compile(r'([\w-]+[<>=]{1}=[\d.\w]+)')
def read_file(filename):
"""Read file correctly."""
with open(filename) as _file:
return _file.read().strip()
def requirements(filename):
"""Parse requirements from file."""
return re.findall(RGX, read_file(filename)) or []
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'"
)
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 :: Software Development',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
setup_requires=['pytest-runner'],
install_requires=requirements('./requirements.txt'),
extras_require={
'test': add_marks(
requirements('./test-requirements.txt'),
{
'uvloop': ' ;' + env_marker,
'httptools': ' ;' + env_marker,
}
)
}
)