2121from setuptools import Extension , setup
2222from setuptools .command .build_ext import build_ext
2323
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 ()
2533
2634
2735def get_version () -> str :
@@ -30,9 +38,6 @@ def get_version() -> str:
3038 return f .read ().split ('"' )[1 ]
3139
3240
33- configuration : dict [str , list [str ]] = {}
34-
35-
3641PILLOW_VERSION = get_version ()
3742AVIF_ROOT = None
3843FREETYPE_ROOT = None
@@ -1047,11 +1052,6 @@ def debug_build() -> bool:
10471052]
10481053
10491054
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-
10551055try :
10561056 setup (
10571057 cmdclass = {"build_ext" : pil_build_ext },
0 commit comments