Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append custom parameter to the end of sys.argv #33

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions _custom_build/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
class _CustomBuildMetaBackend(backend_class):
def run_setup(self, setup_script="setup.py"):
if self.config_settings:
params = []
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.append(f"--pillow-configuration={key}={value}")

sys.argv = sys.argv[:1] + params + sys.argv[1:]
return super().run_setup(setup_script)

def build_wheel(
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,10 +998,9 @@ def debug_build():


# 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)
while sys.argv[-1].startswith("--pillow-configuration="):
_, key, value = sys.argv.pop().split("=", 2)
configuration.setdefault(key, []).append(value)
del sys.argv[1]

try:
setup(
Expand Down
Loading