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