mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
support multiple --config-settings
This commit is contained in:
parent
b4e690049d
commit
f27b838a45
|
@ -12,13 +12,11 @@ class _CustomBuildMetaBackend(backend_class):
|
|||
def run_setup(self, setup_script="setup.py"):
|
||||
if self.config_settings:
|
||||
params = []
|
||||
for k, v in self.config_settings.items():
|
||||
if isinstance(v, list):
|
||||
msg = "Conflicting options: " + ", ".join(
|
||||
f"'--config-setting {k}={v_}'" for v_ in v
|
||||
)
|
||||
raise ValueError(msg)
|
||||
params.append(f"--pillow-configuration={k}={v}")
|
||||
for key, values in self.config_settings.items():
|
||||
if not isinstance(values, list):
|
||||
values = [values]
|
||||
for value in values:
|
||||
params.append(f"--pillow-configuration={key}={value}")
|
||||
|
||||
sys.argv = sys.argv[:1] + params + sys.argv[1:]
|
||||
return super().run_setup(setup_script)
|
||||
|
|
|
@ -92,7 +92,7 @@ version = {attr = "PIL.__version__"}
|
|||
[tool.cibuildwheel]
|
||||
before-all = ".github/workflows/wheels-dependencies.sh"
|
||||
build-verbosity = 1
|
||||
config-settings = "raqm=vendor fribidi=vendor imagequant=disable"
|
||||
config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable"
|
||||
test-command = "cd {project} && .github/workflows/wheels-test.sh"
|
||||
test-extras = "tests"
|
||||
|
||||
|
|
13
setup.py
13
setup.py
|
@ -339,7 +339,7 @@ class pil_build_ext(build_ext):
|
|||
|
||||
@staticmethod
|
||||
def check_configuration(option, value):
|
||||
return True if configuration.get(option) == value else None
|
||||
return True if value in configuration.get(option, []) else None
|
||||
|
||||
def initialize_options(self):
|
||||
self.disable_platform_guessing = self.check_configuration(
|
||||
|
@ -354,7 +354,7 @@ class pil_build_ext(build_ext):
|
|||
setattr(self, f"vendor_{x}", self.check_configuration(x, "vendor"))
|
||||
if self.check_configuration("debug", "true"):
|
||||
self.debug = True
|
||||
self.parallel = configuration.get("parallel")
|
||||
self.parallel = configuration.get("parallel", [None])[-1]
|
||||
|
||||
def finalize_options(self):
|
||||
build_ext.finalize_options(self)
|
||||
|
@ -402,9 +402,6 @@ class pil_build_ext(build_ext):
|
|||
raise ValueError(msg)
|
||||
_dbg("Using vendored version of %s", x)
|
||||
self.feature.vendor.add(x)
|
||||
if x == "raqm":
|
||||
_dbg("--vendor-raqm implies --enable-raqm")
|
||||
self.feature.required.add(x)
|
||||
|
||||
def _update_extension(self, name, libraries, define_macros=None, sources=None):
|
||||
for extension in self.extensions:
|
||||
|
@ -1004,11 +1001,7 @@ ext_modules = [
|
|||
# parse configuration from _custom_build/backend.py
|
||||
while len(sys.argv[1]) >= 2 and sys.argv[1].startswith("--pillow-configuration="):
|
||||
_, key, value = sys.argv[1].split("=", 2)
|
||||
old = configuration.get(key)
|
||||
if old is not None:
|
||||
msg = f"Conflicting options: '-C {key}={old}' and '-C {key}={value}'"
|
||||
raise ValueError(msg)
|
||||
configuration[key] = value
|
||||
configuration.setdefault(key, []).append(value)
|
||||
del sys.argv[1]
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user