21
21
from setuptools import Extension , setup
22
22
from setuptools .command .build_ext import build_ext
23
23
24
- ParallelCompile ("MAX_CONCURRENCY" ).install ()
24
+ configuration : dict [str , list [str ]] = {}
25
+
26
+ # parse configuration from _custom_build/backend.py
27
+ while sys .argv [- 1 ].startswith ("--pillow-configuration=" ):
28
+ _ , key , value = sys .argv .pop ().split ("=" , 2 )
29
+ configuration .setdefault (key , []).append (value )
30
+
31
+ default = int (configuration .get ("parallel" , ["4" ])[- 1 ])
32
+ ParallelCompile ("MAX_CONCURRENCY" , default ).install ()
25
33
26
34
27
35
def get_version () -> str :
@@ -30,9 +38,6 @@ def get_version() -> str:
30
38
return f .read ().split ('"' )[1 ]
31
39
32
40
33
- configuration : dict [str , list [str ]] = {}
34
-
35
-
36
41
PILLOW_VERSION = get_version ()
37
42
AVIF_ROOT = None
38
43
FREETYPE_ROOT = None
@@ -1047,11 +1052,6 @@ def debug_build() -> bool:
1047
1052
]
1048
1053
1049
1054
1050
- # parse configuration from _custom_build/backend.py
1051
- while sys .argv [- 1 ].startswith ("--pillow-configuration=" ):
1052
- _ , key , value = sys .argv .pop ().split ("=" , 2 )
1053
- configuration .setdefault (key , []).append (value )
1054
-
1055
1055
try :
1056
1056
setup (
1057
1057
cmdclass = {"build_ext" : pil_build_ext },
0 commit comments