2727
2828CYTHON_DEPENDENCY = 'Cython(>=0.29.24,<0.30.0)'
2929
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-
5430CFLAGS = ['-O2' ]
5531LDFLAGS = []
5632
@@ -170,6 +146,18 @@ def finalize_options(self):
170146 if getattr (self , '_initialized' , False ):
171147 return
172148
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+
173161 need_cythonize = self .cython_always
174162 cfiles = {}
175163
@@ -235,47 +223,16 @@ def finalize_options(self):
235223
236224setup_requires = []
237225
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+ ):
240230 # No Cython output, require Cython to build.
241231 setup_requires .append (CYTHON_DEPENDENCY )
242232
243233
244234setuptools .setup (
245- name = 'asyncpg' ,
246235 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- author_email = 'hello@magic.io' ,
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- },
279236 ext_modules = [
280237 setuptools .extension .Extension (
281238 "asyncpg.pgproto.pgproto" ,
@@ -291,9 +248,6 @@ def finalize_options(self):
291248 extra_compile_args = CFLAGS ,
292249 extra_link_args = LDFLAGS ),
293250 ],
294- install_requires = ['typing-extensions>=3.7.4.3;python_version<"3.8"' ],
295251 cmdclass = {'build_ext' : build_ext , 'build_py' : build_py , 'sdist' : sdist },
296- test_suite = 'tests.suite' ,
297- extras_require = EXTRA_DEPENDENCIES ,
298252 setup_requires = setup_requires ,
299253)
0 commit comments