Use "parallel" config setting and 4 as defaults

This commit is contained in:
Andrew Murray 2025-06-21 22:22:46 +10:00
parent a549c5528a
commit ecd264fffc

View File

@ -21,7 +21,15 @@ from pybind11.setup_helpers import ParallelCompile
from setuptools import Extension, setup from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
ParallelCompile("MAX_CONCURRENCY").install() configuration: dict[str, list[str]] = {}
# parse configuration from _custom_build/backend.py
while sys.argv[-1].startswith("--pillow-configuration="):
_, key, value = sys.argv.pop().split("=", 2)
configuration.setdefault(key, []).append(value)
default = int(configuration.get("parallel", ["4"])[-1])
ParallelCompile("MAX_CONCURRENCY", default).install()
def get_version() -> str: def get_version() -> str:
@ -30,9 +38,6 @@ def get_version() -> str:
return f.read().split('"')[1] return f.read().split('"')[1]
configuration: dict[str, list[str]] = {}
PILLOW_VERSION = get_version() PILLOW_VERSION = get_version()
AVIF_ROOT = None AVIF_ROOT = None
FREETYPE_ROOT = None FREETYPE_ROOT = None
@ -1047,11 +1052,6 @@ ext_modules = [
] ]
# parse configuration from _custom_build/backend.py
while sys.argv[-1].startswith("--pillow-configuration="):
_, key, value = sys.argv.pop().split("=", 2)
configuration.setdefault(key, []).append(value)
try: try:
setup( setup(
cmdclass={"build_ext": pil_build_ext}, cmdclass={"build_ext": pil_build_ext},