|
1 | 1 | import os
|
2 | 2 | import pathlib
|
3 |
| -import re |
4 | 3 | import sys
|
5 | 4 |
|
6 | 5 | from setuptools import Extension, setup
|
|
43 | 42 | ]
|
44 | 43 |
|
45 | 44 |
|
46 |
| -txt = (HERE / "aiohttp" / "__init__.py").read_text("utf-8") |
47 |
| -try: |
48 |
| - version = re.findall(r'^__version__ = "([^"]+)"\r?$', txt, re.M)[0] |
49 |
| -except IndexError: |
50 |
| - raise RuntimeError("Unable to determine version.") |
| 45 | +build_type = "Pure" if NO_EXTENSIONS else "Accelerated" |
| 46 | +setup_kwargs = {} if NO_EXTENSIONS else {"ext_modules": extensions} |
51 | 47 |
|
52 |
| -install_requires = [ |
53 |
| - "charset-normalizer>=2.0,<3.0", |
54 |
| - "multidict>=4.5,<7.0", |
55 |
| - "async_timeout>=4.0a2,<5.0", |
56 |
| - 'asynctest==0.13.0; python_version<"3.8"', |
57 |
| - "yarl>=1.0,<2.0", |
58 |
| - "typing_extensions>=3.7.4", |
59 |
| - "frozenlist>=1.1.1", |
60 |
| - "aiosignal>=1.1.2", |
61 |
| -] |
62 |
| - |
63 |
| - |
64 |
| -def read(f): |
65 |
| - return (HERE / f).read_text("utf-8").strip() |
66 |
| - |
67 |
| - |
68 |
| -args = dict( |
69 |
| - name="aiohttp", |
70 |
| - version=version, |
71 |
| - description="Async http client/server framework (asyncio)", |
72 |
| - long_description=read("README.rst"), |
73 |
| - long_description_content_type="text/x-rst", |
74 |
| - classifiers=[ |
75 |
| - "License :: OSI Approved :: Apache Software License", |
76 |
| - "Intended Audience :: Developers", |
77 |
| - "Programming Language :: Python", |
78 |
| - "Programming Language :: Python :: 3", |
79 |
| - "Programming Language :: Python :: 3.7", |
80 |
| - "Programming Language :: Python :: 3.8", |
81 |
| - "Programming Language :: Python :: 3.9", |
82 |
| - "Programming Language :: Python :: 3.10", |
83 |
| - "Development Status :: 5 - Production/Stable", |
84 |
| - "Operating System :: POSIX", |
85 |
| - "Operating System :: MacOS :: MacOS X", |
86 |
| - "Operating System :: Microsoft :: Windows", |
87 |
| - "Topic :: Internet :: WWW/HTTP", |
88 |
| - "Framework :: AsyncIO", |
89 |
| - ], |
90 |
| - author="Nikolay Kim", |
91 |
| - |
92 |
| - maintainer=", ".join( |
93 |
| - ( |
94 |
| - "Nikolay Kim <[email protected]>", |
95 |
| - "Andrew Svetlov <[email protected]>", |
96 |
| - ) |
97 |
| - ), |
98 |
| - maintainer_email="[email protected]", |
99 |
| - url="https://github.com/aio-libs/aiohttp", |
100 |
| - project_urls={ |
101 |
| - "Chat: Gitter": "https://gitter.im/aio-libs/Lobby", |
102 |
| - "CI: GitHub Actions": "https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI", # noqa |
103 |
| - "Coverage: codecov": "https://codecov.io/github/aio-libs/aiohttp", |
104 |
| - "Docs: Changelog": "https://docs.aiohttp.org/en/stable/changes.html", |
105 |
| - "Docs: RTD": "https://docs.aiohttp.org", |
106 |
| - "GitHub: issues": "https://github.com/aio-libs/aiohttp/issues", |
107 |
| - "GitHub: repo": "https://github.com/aio-libs/aiohttp", |
108 |
| - }, |
109 |
| - license="Apache 2", |
110 |
| - packages=["aiohttp"], |
111 |
| - python_requires=">=3.7", |
112 |
| - install_requires=install_requires, |
113 |
| - extras_require={ |
114 |
| - "speedups": [ |
115 |
| - "aiodns>=1.1", |
116 |
| - "Brotli", |
117 |
| - "cchardet", |
118 |
| - ], |
119 |
| - }, |
120 |
| - include_package_data=True, |
121 |
| -) |
122 |
| - |
123 |
| -if not NO_EXTENSIONS: |
124 |
| - print("*********************") |
125 |
| - print("* Accelerated build *") |
126 |
| - print("*********************") |
127 |
| - setup(ext_modules=extensions, **args) |
128 |
| -else: |
129 |
| - print("*********************") |
130 |
| - print("* Pure Python build *") |
131 |
| - print("*********************") |
132 |
| - setup(**args) |
| 48 | +print("*********************", file=sys.stderr) |
| 49 | +print("* {build_type} build *".format_map(locals()), file=sys.stderr) |
| 50 | +print("*********************", file=sys.stderr) |
| 51 | +setup(**setup_kwargs) |
0 commit comments