File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Parallelized the Cython extension compilation by defaulting
2+ ``build_ext.parallel `` to ``os.cpu_count() ``, so each module's
3+ ``gcc `` invocation now runs concurrently instead of one at a time
4+ -- by :user: `bdraco `.
Original file line number Diff line number Diff line change 33import sys
44
55from setuptools import Extension , setup
6+ from setuptools .command .build_ext import build_ext
67
78if sys .version_info < (3 , 10 ):
89 raise RuntimeError ("aiohttp 4.x requires Python 3.10+" )
8788]
8889
8990
91+ class ParallelBuildExt (build_ext ):
92+ def build_extensions (self ) -> None :
93+ if self .parallel is None :
94+ self .parallel = os .cpu_count () or 1
95+ super ().build_extensions ()
96+
97+
9098build_type = "Pure" if NO_EXTENSIONS else "Accelerated"
91- setup_kwargs = {} if NO_EXTENSIONS else {"ext_modules" : extensions }
99+ setup_kwargs = (
100+ {}
101+ if NO_EXTENSIONS
102+ else {"ext_modules" : extensions , "cmdclass" : {"build_ext" : ParallelBuildExt }}
103+ )
92104
93105print ("*********************" , file = sys .stderr )
94106print ("* {build_type} build *" .format_map (locals ()), file = sys .stderr )
You can’t perform that action at this time.
0 commit comments