27
27
28
28
CYTHON_DEPENDENCY = 'Cython(>=0.29.24,<0.30.0)'
29
29
30
- # Minimal dependencies required to test asyncpg.
31
- TEST_DEPENDENCIES = [
32
- 'flake8~=5.0.4' ,
33
- 'uvloop>=0.15.3; platform_system != "Windows"' ,
34
- ]
35
-
36
- # Dependencies required to build documentation.
37
- DOC_DEPENDENCIES = [
38
- 'Sphinx~=4.1.2' ,
39
- 'sphinxcontrib-asyncio~=0.3.0' ,
40
- 'sphinx_rtd_theme~=0.5.2' ,
41
- ]
42
-
43
- EXTRA_DEPENDENCIES = {
44
- 'docs' : DOC_DEPENDENCIES ,
45
- 'test' : TEST_DEPENDENCIES ,
46
- # Dependencies required to develop asyncpg.
47
- 'dev' : [
48
- CYTHON_DEPENDENCY ,
49
- 'pytest>=6.0' ,
50
- ] + DOC_DEPENDENCIES + TEST_DEPENDENCIES
51
- }
52
-
53
-
54
30
CFLAGS = ['-O2' ]
55
31
LDFLAGS = []
56
32
@@ -170,6 +146,18 @@ def finalize_options(self):
170
146
if getattr (self , '_initialized' , False ):
171
147
return
172
148
149
+ if not self .cython_always :
150
+ self .cython_always = bool (os .environ .get (
151
+ "ASYNCPG_BUILD_CYTHON_ALWAYS" ))
152
+
153
+ if self .cython_annotate is None :
154
+ self .cython_annotate = os .environ .get (
155
+ "ASYNCPG_BUILD_CYTHON_ANNOTATE" )
156
+
157
+ if self .cython_directives is None :
158
+ self .cython_directives = os .environ .get (
159
+ "ASYNCPG_BUILD_CYTHON_DIRECTIVES" )
160
+
173
161
need_cythonize = self .cython_always
174
162
cfiles = {}
175
163
@@ -235,47 +223,16 @@ def finalize_options(self):
235
223
236
224
setup_requires = []
237
225
238
- if (not (_ROOT / 'asyncpg' / 'protocol' / 'protocol.c' ).exists () or
239
- '--cython-always' in sys .argv ):
226
+ if (
227
+ not (_ROOT / 'asyncpg' / 'protocol' / 'protocol.c' ).exists ()
228
+ or os .environ .get ("ASYNCPG_BUILD_CYTHON_ALWAYS" )
229
+ ):
240
230
# No Cython output, require Cython to build.
241
231
setup_requires .append (CYTHON_DEPENDENCY )
242
232
243
233
244
234
setuptools .setup (
245
- name = 'asyncpg' ,
246
235
version = VERSION ,
247
- description = 'An asyncio PostgreSQL driver' ,
248
- long_description = readme ,
249
- classifiers = [
250
- 'Development Status :: 5 - Production/Stable' ,
251
- 'Framework :: AsyncIO' ,
252
- 'Intended Audience :: Developers' ,
253
- 'License :: OSI Approved :: Apache Software License' ,
254
- 'Operating System :: POSIX' ,
255
- 'Operating System :: MacOS :: MacOS X' ,
256
- 'Operating System :: Microsoft :: Windows' ,
257
- 'Programming Language :: Python :: 3 :: Only' ,
258
- 'Programming Language :: Python :: 3.7' ,
259
- 'Programming Language :: Python :: 3.8' ,
260
- 'Programming Language :: Python :: 3.9' ,
261
- 'Programming Language :: Python :: 3.10' ,
262
- 'Programming Language :: Python :: Implementation :: CPython' ,
263
- 'Topic :: Database :: Front-Ends' ,
264
- ],
265
- platforms = ['macOS' , 'POSIX' , 'Windows' ],
266
- python_requires = '>=3.7.0' ,
267
- zip_safe = False ,
268
- author = 'MagicStack Inc' ,
269
-
270
- url = 'https://github.com/MagicStack/asyncpg' ,
271
- license = 'Apache License, Version 2.0' ,
272
- packages = setuptools .find_packages (
273
- exclude = ['tests' , 'tools' ],
274
- ),
275
- package_data = {
276
- # Cython sources needed for tracebacks
277
- "" : ["*.pyx" , "*.pxd" , "*.pxi" ],
278
- },
279
236
ext_modules = [
280
237
setuptools .extension .Extension (
281
238
"asyncpg.pgproto.pgproto" ,
@@ -291,9 +248,6 @@ def finalize_options(self):
291
248
extra_compile_args = CFLAGS ,
292
249
extra_link_args = LDFLAGS ),
293
250
],
294
- install_requires = ['typing-extensions>=3.7.4.3;python_version<"3.8"' ],
295
251
cmdclass = {'build_ext' : build_ext , 'build_py' : build_py , 'sdist' : sdist },
296
- test_suite = 'tests.suite' ,
297
- extras_require = EXTRA_DEPENDENCIES ,
298
252
setup_requires = setup_requires ,
299
253
)
0 commit comments